css - Div inside Div align? -


this code >> http://jsfiddle.net/374rk/1/

<div class="container">     <div class="logo"></div>     <div class="buttons"></div>     <div class="chef"></div>     <div class="social"></div> </div> 

as can see, have several divs inside big div container. centered, want social div (last one) stick right, margin of 20 px in place. 1 best way this?

if give social relative position, adding right property 590px. correct way it? it's not elegant! also, if float right, won't anymore on container (because floated it).

this has been bugging me while working on css. hope guys can help!

what need set floating of .social-div right. let wrapper still wrap of childs clearfix can help:

html:

<div class="container">     <div class="logo"></div>     <div class="buttons"></div>     <div class="chef"></div>     <div class="social"></div>     <div style="clear:both;"></div> </div> 

css:

.social {     width: 200px;     height: 25px;     float:right;     margin-right:20px;     background-color: #ff0; } 

http://jsfiddle.net/avlu8/


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -