CSS - width not honored on span tag

后端 未结 5 1496
青春惊慌失措
青春惊慌失措 2021-02-06 23:26

I have a issue with one of my spans. Please consider the following styles:

.form_container .col1che
{
float: left; 
width: 4%; 
text-align: left;    
}

.form_c         


        
5条回答
  •  终归单人心
    2021-02-06 23:53

    Width is not honored because span is an inline element. To fix this, add:

    display: inline-block;
    

    Depending on your situation, display: inline-block may be better than display: block because any content after the span won't be forced onto a new line.

提交回复
热议问题