Reputation: 593
I am working on an un-ordered list. I have searched all over the internet for a good tutorial but I cannot find one. I want to display it inline and have a border line in between each <li>
item. Now I am just unsure of the standards for styling lists. Do I use padding/margins to position the <li>
items? If so do I apply it to the <ul>
container or <li>
or <a>
?
Upvotes: 0
Views: 115
Reputation: 82267
Try using margins, borders, and float.
<html>
<head>
<style type="text/css">
.liClass
{
float:left;
padding-right:10px;
padding-left:10px;
border-right:thick double #ff0000;
}
.lastLi
{
float:left;
padding-left:10px;
}
</style>
</head>
<body>
<ul>
<li class="liClass">one</li>
<li class="liClass">two</li>
<li class="lastLi">three</li>
</ul>
</body>
</html>
Upvotes: 1
Reputation: 53971
You can use display: inline-block
to avoid having to mess with clearing floats:
Upvotes: 0
Reputation: 324610
Use display: inline-block
to make the list items appear side-by-side (it is more reliable than float: left
), then add borders or whatever else you want - maybe a width
and some margin
.
Upvotes: 0