0

I have a unordered list of images and I need to display them horizontally in a row with no margin/padding or list styling, what CSS would I use to do this?

Here is my html code:

<div id="carouselContainer">
    <ul id="carousel-list">
        <li><a href="/"><img src="image.png" alt="Desc" /></a></li>
        <li><a href="/"><img src="image.png" alt="Desc" /></a></li>
        <li><a href="/"><img src="image.png" alt="Desc" /></a></li>
        <li><a href="/"><img src="image.png" alt="Desc" /></a></li>
    </ul>
</div>

Any help with this would be great

Ghasan غسان
  • 5,577
  • 4
  • 33
  • 44
user2498890
  • 1,528
  • 4
  • 25
  • 58
  • possible duplicate of [CSS Horizontal list items](http://stackoverflow.com/questions/15710701/css-horizontal-list-items) – fabian Aug 22 '14 at 12:37

5 Answers5

3

Setting the float to left will make the list horizontally

li {
    float: left;
}
XD face me
  • 578
  • 1
  • 3
  • 12
2

Add the following CSS.

 #carousel-list{padding:0;margin:0;}
 #carousel-list li{display:inline-block;}

DEMO

Suresh Ponnukalai
  • 13,820
  • 5
  • 34
  • 54
2

Try this

FIDDLE DEMO

#carousel-list {
    display: inline;
    list-style-type: none;
    padding:0;
    margin:0;
}
Richa
  • 3,261
  • 2
  • 27
  • 51
2
#carousel-list li
{
    display: inline-block;
}

#carousel-list
{
    list-style-type: none;
}

but google is faster

rdmptn
  • 5,413
  • 1
  • 16
  • 29
1

what about CSS:

ul, li {
  margin: 0;
  padding: 0;
  list-style:none;
}

li {
  display: inline;
}
Axel
  • 3,331
  • 11
  • 35
  • 58