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

前端 未结 11 1790
余生分开走
余生分开走 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:41

    I had the same issue. I wanted icons to appear by pressing the button but without any movement and sliding the enviroment, just like bulb: on and off, appeared and dissapeared, so I needed to make an empty div with fixed sizes.

    width: 13px;
    min-width: 13px;
    

    did the trick for me

提交回复
热议问题