html - CSS large space before div on left when having two divs on right under each other -
i developing social network , having problems profile pages. doing having 3 divs (as example). 1 being main 'post' part, other 2 being 'about me' , 'friends' section. have post 1 floating on left, , sidebars floating on right. when have 2 divs on sidebar on right, post div not go directly under cover, there giant space there if there invisible div there http://prntscr.com/3988wj here html
<div id="sidebar"> <div class="sidebar-container"> <div class="sidebar-content"> <div class="sidebar-header">about</div> <div class="sidebar-list">birthday: <b>09/05/2000</b></div> <div class="sidebar-list">gender: <b>male</b></div> </div> </div> </div> <div id="sidebar"> <div class="sidebar-container"> <div class="sidebar-content"> <div class="sidebar-header">friends</div> <div class="sidebar-list">birthday: <b>09/05/2000</b></div> <div class="sidebar-list">gender: <b>male</b></div> </div> </div> </div> <div id="message"> <div class="message-container"> <div class="message-content"> <div class="message-padding"> <div class="message-avatar"><img src="<?php echo $avatar; ?>"></div> <div class="message-author"><a href=""><?php echo $user; ?></a></div> <div class="message-date">12/04/2014</div> </div> </div> </div> </div>
here css
#message { float: left; margin-left: 20%; width: 44.4%; } .message-padding { padding: 10px 10px 10px 10px; } .message-container { padding: 0 10px 10px 0; } .message-content { box-shadow: 0px 1px 1px #ccc; border: 1px solid #bfbfbf; background: #fff; color: #6b6b6b; border-radius: 3px; overflow: hidden; width: 100%; } .message-avatar { width: 42px; height: 42px; float: left; padding-bottom: 10px; } .message-avatar img { width: 42px; height: 42px; border-radius: 3px; } .message-author { color: #3a5796; font-size: 12px; cursor: pointer; font-weight: bold; font-family: tahoma, arial, 'segoe ui', verdana, sans-serif; padding-left: 50px; padding-top: 5px; text-decoration: none; } .message-author { color: #3a5796; cursor: pointer; font-weight: bold; font-family: tahoma, arial, 'segoe ui', verdana, sans-serif; text-decoration: none; } .message-date { color: #999; font-size: 10px; cursor: pointer; font-weight: bold; font-family: tahoma, arial, 'segoe ui', verdana, sans-serif; padding-left: 50px; padding-top: 4px; } #sidebar { float: right; margin-right: 19.49%; width: 16%; clear:both; } .sidebar-container { padding: 0 10px 10px 0; } .sidebar-list { margin-top: -1px; padding: 7px 10px; border-top: 1px solid #eee; font-size: 12px; } .sidebar-content { box-shadow: 0px 1px 1px #ccc; border: 1px solid #bfbfbf; background: #fff; color: #6b6b6b; border-radius: 3px; overflow: hidden; width: 100%; } .sidebar-header { background: #f8f8f8; padding: 10px; font-family: tahoma, verdana, arial, sans-serif; font-size: 13px; font-weight: bold; color: #777; border-bottom: 1px solid #eee; width: 100%; }
is there way make post div goes in right place, , other post divs can go under it, , other divs in sidebar? help!
put 2 sidebars in div , float div right.
actually, can make 2 divs id "sidebar" 1 div. having 2 elements same id invalid anyway.
so html part looks this:
<div id="sidebar"> <div class="sidebar-container"> <div class="sidebar-content"> <div class="sidebar-header">about</div> <div class="sidebar-list">birthday: <b>09/05/2000</b></div> <div class="sidebar-list">gender: <b>male</b></div> </div> </div> <!-- here closing , re-opening div removed --> <div class="sidebar-container"> <div class="sidebar-content"> <div class="sidebar-header">friends</div> <div class="sidebar-list">birthday: <b>09/05/2000</b></div> <div class="sidebar-list">gender: <b>male</b></div> </div> </div> </div>
the result this: http://jsfiddle.net/48bfu/
Comments
Post a Comment