html - Div does not fill parent with width:100% -


html

<main>     <div class="homediv">         <p>test</p>     </div> </main 

css

div.homediv {   background-color: yellow;   width: 100%;   position: static;   /*the lower z-index, further in background element*/   z-index: -1; } 

at first glance, should make div horizontally fill screen. did not. few answers on here said width:100% work when width of parent set, set. ensure that, gave html, body, main , div width:100% attribute. did not fix it.

after trying around in chrome devtools, found out main fill screen width. contained seemingly pre-set attributes had remove. google told me padding , margin - if not specified - set browser, fix css, had add

main {   padding:0;   margin:0; } 

i posted here in hopes helps somebody, if reason believe should not on here - maybe because might seem noobish mistake - guess can understand if gets downvoted


Comments

Popular posts from this blog

php - Zend Framework / Skeleton-Application / Composer install issue -

c# - Better 64-bit byte array hash -

python - PyCharm Type error Message -