How to make a div with no content have a width?

前端 未结 11 1780
余生分开走
余生分开走 2020-12-12 20:13

I am trying to add a width to a div, but I seem to be running into a problem because it has no content.

Here is the CSS and HTML I have so far, but it is

11条回答
  •  离开以前
    2020-12-12 20:38

    Use min-height: 1px; Everything has at least min-height of 1px so no extra space is taken up with nbsp or padding, or being forced to know the height first.

提交回复
热议问题