css - Whitespace at the end of the HTML -
i trying dynamic grid layout links other pages, consisting of picture , text. problem don't seem find way of introducing whitespace (padding/margin) after grid layout. in other words, page ends main div ends.
here code. appreciated, have tried lot of methods, , neither 1 of them worked. lot.
<!doctype html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <link rel="stylesheet" type="text/css" media="screen" href="resources/index.css" /> </head> <body> <div class="header"></div> <div class="body"> <!-- standard link each category, inserted n times .. problem visible after inserting min of 12 times--> <a href="" class="categorie"> <img src="imgs/asd.png" class="imagine"/> <div class="nume"> </div> </a> </div> </body> </html>
css :
html { background-color:grey; height:auto; } body { display: table; padding:20px; margin: 0 auto; height:100%; } .header { background-color:white; width:700px; margin-left:auto; margin-right:auto; margin-top:40px; height:75px; } .body, .body>html { background-color:black; width:700px; margin-top:5px; margin-left:auto; margin-right:auto; margin-bottom:20px; padding-bottom:20px; position:absolute; display:block; height:auto; } .categorie { background-color:white; margin-left:20px; float:left; margin-top:20px; height:180px; width:150px; } .imagine { width:150px; height:150px; } .nume { background-color:green; width:150px; height:30px; margin-top:-5px; }
i'm not sure why there display: table on body element, said:
"because use position:absolute in .body class.. otherwise, .body not extend encapsulate of links."
so able remedy both problems removing both display: table body element , position: absolute body class, added overflow: auto body class.
the css:
body{ padding:20px; margin: 0 auto; height:100%; } .body, .body>html { background-color:black; width:700px; margin-top:5px; margin-left:auto; margin-right:auto; margin-bottom:20px; padding-bottom:20px; display:block; height:auto; overflow: auto; }
the jsfiddle: http://jsfiddle.net/artsen/vhsdg/
Comments
Post a Comment