can we assign width to li
Try this CSS
ul {
white-space: nowrap;
height: 1em;
width: 100%;
}
li {
list-style-type: none;
width: 100px;
overflow-x: auto; /* change to hidden if that's what you want */
float: left;
margin-right: 10px;
}
No, you can't assign width to anything that is displayed inline, which you've set your LI
to be. Instead, you most often want to use display: block; float: left;
which'll allow for setting width.
Try to replace your display:inline
by display:inline-block