100% width divs not spanning entire width of the browser in webkit

前端 未结 8 1014
南方客
南方客 2021-01-08 01:10

I\'m having a hard time with what I thought would be a dead simple issue.

I\'m trying to create a div that spans 100% of the width of a browser window. The div is f

8条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-08 01:31

    I had the same problem, this is what I discovered: somewhere in your CSS you have another div that has a width of 100% and ALSO has padding. Since the padding value is added to the width, the value of that div becomes greater than 100%. The solution is to make sure not to use padding on any div that is set to 100% width. If you need padding, try adding the padding to the element inside the div instead.

提交回复
热议问题