Forum Moderators: not2easy
#contain {
float: left;
display: inline;
width:auto;
height: 25px;
position: absolute;
top: 106px;
right: 12px;
overflow:visible;
margin: 0px;
padding: 0px;
border: thin solid #006600;
}
#plus{
display: inline;
overflow:visible;
position:relative;
width:auto;
vertical-align:top;
background-color: #00CC33;
margin: 0px;
padding: 0px;
height: 25px;
/*background-color:#00CC99;*/
}
<div id="contain"><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.example.com&send=false&layout=button_count&width=108
&show_faces=false&action=like&colorscheme=light&font&a
mp;height=21" scrolling="no" frameborder="0" style="border:none;
overflow:hidden; vertical-align:top; display:inline; width:108px; height:21px; margin:0px;" allowTransparency="true"></iframe> <div id="plus"><!-- twitter --> <a href="http://twitter.com/share" class="twitter-share-button" data-count="none" data-via="onlinehoteles" data-lang="es">Tweet</a>
<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script><!-- fin twitter --><!-- myspace --> <a href="javascript:void(window.open('http://www.myspace.com/Modules/PostTo/Pages/?u='+encodeURIComponent
(document.location.toString()),'ptm','height=450,width=550').focus
())"> <img src="../images/myspace.gif" alt="Share on Myspace" name="my" width="20" height="20" border="0" /></a><!-- fin myspace --> <a href="javascript:print()"><img src="../images/imprimir.gif" alt="Imprimir" border="0"></a> <g:plusone size="medium" count="false"></g:plusone><!-- fin redes --></div></div>
[edited by: alt131 at 7:44 pm (utc) on Jun 30, 2011]
[edit reason] Side Scroll [/edit]
iframes therefore it's the iframes you need to float to get them to line up, not the divs they are contained in (as the iframes will generally appear in the same div) <div id="contain">
<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.example.com&send=false&layout=button_count&width=108
&show_faces=false&action=like&colorscheme=light&font&a
mp;height=21" scrolling="no" frameborder="0" style="border:none;
overflow:hidden; vertical-align:top; display:inline; width:108px;
height:21px; margin:0px;" allowTransparency="true"></iframe>
<div id="plus">
<!-- twitter -->
<a href="http://twitter.com/share" class="twitter-share-button" data-
count="none" data-via="onlinehoteles" data-lang="es">Tweet</a>
<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
<!-- fin twitter -->
<!-- myspace -->
<a href="javascript:void(window.open('http://www.myspace.com/Modules/PostTo/Pages/?u='+encodeURIComponent
(document.location.toString()),'ptm','height=450,width=550').focus())">
<img src="../images/myspace.gif" alt="Share on Myspace" name="my"
width="20" height="20" border="0" /></a>
<!-- fin myspace -->
<a href="javascript:print()"><img src="../images/imprimir.gif" alt="Imprimir" border="0"></a>
<g:plusone size="medium" count="false"></g:plusone><!-- fin redes -->
</div>
</div>
#contain iframe {background: #dad; float: left;}
#plus iframe {height: 21px !important;}
[edited by: alt131 at 11:14 pm (utc) on Jun 30, 2011]
[edit reason] Side Scroll [/edit]
#contain iframe {background: float: left;}
#plus iframe {height: 21px !important; float: left;}
BTW my code already worked ok in Firefox, in IE8 is showing the newlineAre you saying that because Suzy suggested firebug for firefox? If so, that is because you need to understand what code is being applied to fix the problem. ie8 has the developer tools, but firebug is easier to use and more powerful.
And what is #dad ? (since not applied to anything in the code#dad is a background colour and setting it is a coding tecnique to help identify the dimensions of the elements when things are causing trouble. It can be any colour at all. As you see from the selector it is being applied to any iframe that is a descendent of div#plus.
Why is 21px height important?This is to set a uniform height for all the iframes. Notice the twitter iframe and myspace button are only 20px high - while the facebook iframe is 21px? Setting 21px height removes that difference.
#contain iframe {background: float: left;}There is no value for the background property so that code won't work as it is invalid. The Opera webdevelopers course has a better explanation about properties and values [dev.opera.com].
!important - this is used to override the inline style produced by the script, however if you're not worried about a 1px difference which is hardly noticeable, just omit that. <div id="___plusone_0" style="height: 24px; width: 106px; display: inline-block; text-indent: 0pt; margin: 0pt; padding: 0pt; background: none repeat scroll 0% 0% transparent; border-style: none; float: none;">
div you'll have to use !important in order to override the inline float: none; - So, very possibly easier, if you want to go with inline-block and vertically align your links/images to match the iframes.. try this: #plus, #plus div, #plus a, #plus img {display: inline-block; vertical-align: top;}
#plus, #plus div, #plus a, #plus img {display: inline !important;}
#plus div - the code above makes everything including the #plus div itself display as an inline block , display: inline !important rule is a hack to make IE7 play nice with inline-block too, and because the Google+ button uses it it may be better this way than using/overriding float rules
<div id="contain">
<iframe scrolling="no" frameborder="0" allowtransparency="true"
style="border:none; overflow:hidden; vertical-align:top;
display:inline; width:108px; height:21px; margin:0px;"
src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%
2Fwww.example.com&send=false&layout=button_count&width=108&show_faces=
false&action=like&colorscheme=light&font&height=21">
<div id="plus">
<iframe class="twitter-share-button twitter-count-none"
scrolling="no" frameborder="0" allowtransparency="true" src="http://platform0.twitter.com/widgets/tweet_button.html?
_=1309885909914&count=none&id=twitter_tweet_button_0&lang=es&original_
referer=http%3A%2F%2Fwww.example.com&text=Hoteles%20en%20Carlos%20Paz%
3A%20hoteles%2C%20Posadas%20en%20Carlos%20Paz&url=http%3A%2F%
2Fwww.example.com%2Fvillacarlospaz%2Fhoteles.htm&via=example"
style="width: 64px; height: 20px;" title="Twi`tter para sitios web:
Botón para Twittear">
<script src="http://platform.twitter.com/widgets.js" type="text/javascript">
<a href="javascript:void(window.open('http://www.myspace.com/Modules/PostTo/Pages/?u='+encodeURIComponent
(document.location.toString()),'ptm','height=450,width=550').focus
())">
<a href="javascript:print()">
<div id="___plusone_0" style="height: 20px; width: 32px; display:
inline-block; text-indent: 0pt; margin: 0pt; padding: 0pt;
background: none repeat scroll 0% 0% transparent; border-style: none;
float: none;">
<iframe width="100%" scrolling="no" frameborder="0" vspace="0"
tabindex="-1" style="position: static; left: 0pt; top: 0pt; width:
300px; height: 20px; visibility: visible;"
src="https://plusone.google.com/u/0/_/+1/button?hl=es-419&jsh=r%
3Bgc%2F22203364-e7648d15#url=http%3A%2F%2Fwww.example.com%
2Fvillacarlospaz%
2Fhoteles.htm&size=medium&count=false&id=I1_1309885910804&
amp;parent=http%3A%2F%2Fwww.online-
hoteles.com.ar&rpctoken=865905068&_methods=onPlusOne%2C_ready%
2C_close%2C_open%2C_resizeMe" name="I1_1309885910804" marginwidth="0"
marginheight="0" id="I1_1309885910804" hspace="0"
allowtransparency="true"></iframe>
#contain {
display: inline;
width:300px;
height: 21px;
position: absolute;
top: 106px;
right: 12px;
overflow:visible;
margin: 0px;
padding: 0px;
border: thin solid #006600;
}
#plus, #plus div, #plus a, #plus img {display: inline !important;}
[edited by: alt131 at 4:55 pm (utc) on Jul 6, 2011]
[edit reason] Side Scroll [/edit]
display: inline-block is not the enemy, it is your friend in this case (glad it's working in IE now!) - most of the newer "like it" "friend it" "+ it" buttons will increasingly use it as it's the "new float" ! display: inline-block; is that when using it it will leave about 4px (0.25em is possibly the more correct way to think of this as it's related to font-size and word-spacing) space between the elements.. coming back to this contain div but I have 3 of 4 I think margin-left: -0.25em works quite well although it has to be hidden from IE7 and below. <div id="contain">
<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%
2Fwww.example.com&send=false&layout=button_count&width=108
&show_faces=false&action=like&colorscheme=light&font&a
mp;height=21" scrolling="no" frameborder="0" style="border:none;
overflow:hidden; vertical-align:top; display:inline; width:108px;
height:21px; margin:0px;" allowTransparency="true">
</iframe>
<div id="plus">
<!-- twitter -->
<a href="http://twitter.com/share" class="twitter-share-button" data-
count="none" data-via="onlinehoteles" data-lang="es">Tweet</a>
<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
<!-- fin twitter -->
<!-- myspace -->
<a href="javascript:void(window.open('http://www.myspace.com/Modules/PostTo/Pages/?u='+encodeURIComponent
(document.location.toString()),'ptm','height=450,width=550').focus
())"> <img src="http://placekitten.com/20/20/" alt="Share on Myspace"
name="my" width="20" height="20" border="0" /></a>
<!-- fin myspace -->
<a href="javascript:print()"><img src="../images/imprimir.gif"
alt="Imprimir" border="0"></a>
<!-- Place this tag where you want the +1 button to render -->
<g:plusone size="medium" count="false"></g:plusone>
<!-- fin redes -->
</div>
</div>
<!-- Place this tag in your head or just before your close body tag -->
<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
#plus, #plus div, #plus a, #plus img {display: inline-block; vertical-
align: top;}
#plus, #plus div, #plus a, #plus img {display: inline !ie7;}
!ie7 is the hack (not !important like I had before) - the first line should make it work in IE8, FF, Webkit et al.. when it does the second one will make it work in IE7 and below <div id="___plusone_0" style="height: 20px; width: 32px; display: inline-block; text-indent: 0pt; margin: 0pt; padding: 0pt;
background: none repeat scroll 0% 0% transparent; border-style: none;
float: none;">
<iframe width="100%" scrolling="no" frameborder="0" vspace="0"
tabindex="-1" style="position: static; left: 0pt; top: 0pt; width:
32px; height: 20px; visibility: visible;"
src="https://plusone.google.com/u/0/_/+1/button?hl=en-US&jsh=r%
3Bgc%2F22203364-e7648d15#url=http%3A%2F%2Flocalhost%
2FPAGENAME&size=medium&count=false&id=I1_1309900397508&
;parent=http%3A%2F%
2Flocalhost&rpctoken=119786061&_methods=onPlusOne%2C_ready%
2C_close%2C_open%2C_resizeMe" name="I1_1309900397508" marginwidth="0"
marginheight="0" id="I1_1309900397508" hspace="0"
allowtransparency="true"></iframe>
</div>
[edited by: alt131 at 4:57 pm (utc) on Jul 6, 2011]
[edit reason] Side Scroll [/edit]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd"> <!DOCTYPE html>