Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to adjust ul width property?

Tags:

html

css

<ul id='ul01'>
    <li><a href='#'><img src='img01.png' width="700" height="590" /></a></li>
    <li><a href='#'><img src='img02.png' width="700" height="590" /></a></li>
    <li><a href='#'><img src='img03.png' width="700" height="590" /></a></li>
</ul>

CSS:

#ul01{list-style:none;width:??;}
#ul01 li{float:left;}

This is a horizontal array of images. list.items.count can vary.
What should be the width property to fit all images.
I tried with - auto - and expected resizible width - but it's not.

like image 588
Alice Avatar asked Jul 17 '12 10:07

Alice


People also ask

How do you change the width of UL?

You just put width property to ul element.

How do you make a full width UL?

Yes, ul is a block level element so it takes full width. If you want to specify element width you can use inline-block.


1 Answers

Make the li elements inline-blocks and set the white-space property of the ul to nowrap.

li {
    display: inline-block;
}
ul {
    white-space: nowrap;
}
like image 83
magicalex Avatar answered Oct 13 '22 11:10

magicalex