Percentage width for fixed elements?

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

I have html like this:

...
...
#con
4条回答
  •  无人共我
    2021-01-12 01:20

    The first div's 70% refers to 70% of the width of #content.

    The second div's 70% refers to 70% of the width of the viewport.

    If you add this CSS, the two div's are the same width:

    html, body {
        margin:0; padding:0
    }
    

    Live Demo

提交回复
热议问题