cover div adding a margin

前端 未结 2 561
失恋的感觉
失恋的感觉 2021-01-24 14:02

i have a #cover div with the following css

#cover {
    background-color: #FFFFFF;
    height: 100%;
    opacity: 0.4;
    position: fi         


        
2条回答
  •  灰色年华
    2021-01-24 14:32

    simple thing to fix.

    Add that to your CSS

    * /*Remove all the default margin and padding*/
    {
        margin: 0;
        padding: 0;
    }
    html, body /*so it'll work when you specify 100% height on element*/
    {
        height: 100%;
    }
    

    BTW: use units(px/%) for margin/padding other then 0.

    and Here's a Fiddle

    also, You don't even need the fixed position for that.. check out that fiddle

提交回复
热议问题