1

I have a list with floated <li> elements, the heights are different, thats the problem. I know I know theres an alternative, display:inline-block but this propery adds extra spaces, and I dont know why.

My css:

ul {
    padding:0;
    margin:0;
    list-style:none;
    width:700px;
}

ul li {
    float:left;
    border:1px solid #000;
    width:24%;
    margin:0 0.3% 20px 0.3%;
    font-size:11px;
}

.yellow {
    background:yellow;
}

online preview: http://jsfiddle.net/f3CA3/1/

user1452062
  • 775
  • 4
  • 10
  • 25
  • Not possible with CSS only. Except the `display: table-*` family maybe. `inline-block` does what it says: do not ignore whitespace (inline) but act as block (expand horizontally as much as possible). – Sergiu Paraschiv Jan 20 '14 at 16:23
  • 1
    For `inline-block` and whitespace see: http://stackoverflow.com/questions/5256533/a-space-between-inline-block-list-items – Paulie_D Jan 20 '14 at 16:25
  • Something like this -> http://jsfiddle.net/f3CA3/3/ ? – Morpheus Jan 20 '14 at 16:28

1 Answers1

1

you can do it clearing the sides as:

clear:both;

or maybe

clear:right;

just as an example, could be also;

clear:left;
Santiago Rebella
  • 2,342
  • 2
  • 19
  • 28