Forum Moderators: not2easy
Is this possible to do within a li tag or should I just create a load of div elements on the page?
Here's what I have so far - I know this isn't correct but I'm just really unsure as to what to do to get everything to align correctly.
.details ul
{
margin: 20px 0 0;
padding: 0;
list-style-type: none;
}
.details ul li
{
width: 443px;
padding-top: 3px;
padding-bottom: 3px;
border-bottom: 1px dotted #979797;
}
<div class="details">
<ul>
<li><a href="#">Line Item 1</a><a href="#"><img src="image1.jpg"></a></li>
<li><a href="#">Line Item 1</a><a href="#"><img src="image2.jpg"></a></li>
</ul>
<div>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en">
<head>
<title>test</title>
<style type="text/css">
.details ul {
width: 540px;
margin: 20px 0 0;
padding: 0;
list-style-type: none;
}
.details ul li
{
float: left;
width: 200px;
padding-top: 3px;
padding-bottom: 3px;
border-bottom: 1px dotted #979797;
}
.details ul li p
{
text-align: right;
margin: 0;
padding: 0;
}
</style>
</head>
<body>
<div class="details">
<ul>
<li><a href="#">Line Item 1</a></li>
<li><p><a href="#"><img src="image1.jpg" alt="" /></a></p></li>
<li><a href="#">Line Item 2</a></li>
<li><p><a href="#"><img src="image2.jpg" alt="" /></a></p></li>
<li><a href="#">Line Item 3</a></li>
<li><p><a href="#"><img src="image3.jpg" alt="" /></a></p></li>
<li><a href="#">Line Item 4</a></li>
<li><p><a href="#"><img src="image4.jpg" alt="" /></a></p></li>
</ul>
</div>
</body>
</html>
I specified the width for the ul element long enough to accommodate one text and one image link. Then I setup a paragraph tag as a driver for the right alignment. The li's have a width of 200px but you should be able to change it if you need different spacing.