Reputation: 869
I am trying to change the default scrolling of li elements from vertical to horizontal. I am able to do this but its coming as a list of elements in a line then another list of elements below it. But I want all the list to be in one single line regardless of number of li elements.
Code in HTML:
<div class="imageGallery">
<ul>
<li><img src="img01.png"/></li>
<li><img src="img02.png"/></li>
<li><img src="img03.png"/></li>
<li><img src="img04.png"/></li>
.....
.....
</ul>
</div>
css:
.imageGallery {
overflow-x: scroll;
overflow-y: hidden;
}
ul {
width: 1500px;
margin: 0;
padding: 0;
}
The output is coming as a horizontal scrollbar with list of images in a line then list of elements below it and so on. How can I make it all to come in single line?
Thanking you all for the help.
Upvotes: 1
Views: 4737
Reputation: 752
if I understand well you want all li elements to stay in one line. put this in your css
.imageGallery ul{
white-space: nowrap
}
.imageGallery li{
display:inline-block
}
Upvotes: 4