if a div is 100% width by default

后端 未结 3 1272
日久生厌
日久生厌 2021-01-02 06:32

If a div is 100% width, should I still put in width: 100%;? I look at a lot of code and it\'s always in there even though by default a div

3条回答
  •  梦毁少年i
    2021-01-02 06:37

    I'm not sure if the children elements will adapt themselfs with procentual values if their parent doesn't have a width attribute. Otherwise it's just semantic and good practice to put width: 100%; if the div is supposed to span 100% of it's parent container.

提交回复
热议问题