That’s ok but would suffer if the user resizes the text or if you have more lines of text and then it will overflow.
I would reverse it and absolutely place the image so that text resize isn’t an issue and then use the method I gave to align the text but use a minimum height.
e.g.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>untitled</title>
<style type="text/css" media="screen">
* {
margin:0;
padding:0;
}
ul {
margin:50px;
padding:0;
list-style:none;
}
ul li {
margin:0 0 2px 0;
padding:10px 0;
min-height:50px;
background:#aaa;
width:190px;
position:relative;
}
* html ul li { height:50px }
ul li a {
color:black;
display:inline-block;
font:1em/1.2 Helvetica, sans-serif;
padding:0 0 0 70px;
text-decoration:none;
vertical-align:bottom;
}
ul li b {
display:inline-block;
vertical-align:bottom;
height:50px;
margin-right:-5px;
width:1px;
overflow:hidden;
}
ul li span {
position:absolute;
left:10px;
top:10px;
width:50px;
height:50px;
background:green;
}
</style>
</head>
<body>
<ul>
<li><a href="#"><span></span>One</a><b></b></li>
<li><a href="#"><span></span>Two - Second Line of Text </a><b></b></li>
<li><a href="#"><span></span>Three</a><b></b></li>
<li><a href="#"><span></span>Four</a><b></b></li>
</ul>
</body>
</html>
remember that along with Paul’s methods, you can always use the :after pseudo element , if you don’t want to muck up your HTML.
ul li:after, ul li span.after{
content:"";
display:inline-block;
vertical-align:bottom;
height:100%;
margin-right:-5px;
width:1px;
overflow:hidden;
}
ul li { zoom:expression(
runtimeStyle.zoom=1,
insertAdjacentHTML('beforeEnd','<span class="after"></span>')
);}
I suppose I should have asked at the start but it looks like you want the whole gray block to be active and if so you can do it like this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>untitled</title>
<style type="text/css" media="screen">
* {
margin:0;
padding:0;
}
ul {
margin:50px;
padding:0;
list-style:none;
}
ul li {
margin:0 0 2px 0;
min-height:50px;
background:#aaa;
width:190px;
position:relative;
}
* html ul li,* html ul li a { height:50px }
ul li a {
border: 1px solid red;
color:black;
display:block;
font:1em/1.2 Helvetica, sans-serif;
padding:10px 0 10px 70px;
text-decoration:none;
min-height:50px;
}
ul li span {
display:inline-block;
vertical-align:bottom;
}
ul li b {
display:inline-block;
vertical-align:bottom;
height:50px;
margin-right:-5px;
width:1px;
overflow:hidden;
}
ul li em {
background:url('http://www.ttmt.org.uk/css4/pic.png') no-repeat top left;
position:absolute;
left:10px;
top:10px;
width:50px;
height:50px;
}
ul li a:hover{visibility:visible}/* ie6 fix */
ul li a:hover em { background:url('http://www.ttmt.org.uk/css4/test.gif') no-repeat top left; }
</style>
</head>
<body>
<ul>
<li><a href="#"><span><em></em>One</span><b></b></a></li>
<li><a href="#"><span><em></em>Two - Second Line of Text </span><b></b></a></li>
<li><a href="#"><span><em></em>Three</span><b></b></a></li>
<li><a href="#"><span><em></em>Four</span><b></b></a></li>
</ul>
</body>
</html>
(You can use more semantic elements or spans with classes if you want).