Percentage width for fixed elements?

后端 未结 4 1198
庸人自扰
庸人自扰 2021-01-12 00:53

I have html like this:

...
...
#con
4条回答
  •  旧时难觅i
    2021-01-12 01:10

    This weird behavior (great question!!) can be referred about the fact that the relative div (first) take the width looking at his father. The second one just look at the viewport, no matter who is its father (and what width is set to its father)!

    This can fix your problem:

    body,html{
        padding:0;
    }
    

    Edit -> Fiddle

提交回复
热议问题