html - Align spans of a list -


i have this: http://jsfiddle.net/lehqyf1t

<ul class="myclass">     <li><span style="background-color:#f608ff"></span>text 1</li>     <li><span style="background-color:#f608ff"></span>text 2</li> </ul> 

css:

.myclass li span {   width: 25px;   height: 25px;   display: block;   float: left;   margin-right: 10px; } 

no matter try cannot both lines aligned properly. how solve it?

you can swap out float display:inline-block , don't have worry clearing floats @ all.

li {    list-style:none;    }    .myclass li span{    width: 25px;    height: 25px;    display: inline-block;    vertical-align: middle;    margin-right: 10px;   background-color:#f608ff;  }
<ul class="myclass">      <li><span></span>text 1</li>      <li><span></span>text 2</li>  </ul>


Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

python - build a suggestions list using fuzzywuzzy -