html - White Space Issue using percentage -
i newbie css while designing 1 page css
body {width:100%;height:920px;margin:0;list-style:none;padding:0;} .side{background-color:#9966ff; width:20%;height:920px;float:left;} .main{background-color:#ccffff; width:80%;height:920px;} <body> <div class="side">its side bar</div> <div class="main">ites center bar</div> </body> but giving me white space after main class understanding if giving body 100% divide space in 20% , 80% in .side , .main class please correct me?
actually, float: left on div.side has effect of making 100% of body's width available div.main. how floating works. remove width: 80% , instead make margin-left: 20%; , you're done.
to better understand what's going on, check following fiddle: https://jsfiddle.net/ex6w7tnz/1/
(which has width on div.main removed not added margin-left.)
so floating div.side not affect width of div.main, position of content inside right of div.side. called floating :) when assign width of 80% div.main, "white-space" assumed right of remaining 20% width of body's 100% div.main not use.
Comments
Post a Comment