Code:
.myButton {
position: relative; /* position parent container so children are relative to me */
width: 400px; /* positioned elements should have width */
height: 400px; /* positioned elements should have height */
float: left; /* so that multiple instances go next to each other */
/* setting up font styles */
color: black;
font-family: Verdana;
font-size: 11px;
text-decoration: none;
}
.myButton img, .myButton p {
position: absolute; /* position is absolute, relative to the parent a.myButton tag */
top: 0px; /* top of element should be 0px from parent element top */
border: none; /* remove border (specifically on img), just looks better */
}
.myButton p {
left: 310px; /* assumes images are 300px wide */
margin-top: 0px; /* removes default top margin on p */
}
Code:
<a href="#" class="myButton">
<img src="image.jpg"/>
<p>This is a long explaination of the image on the left.</p>
</a>
<a href="#" class="myButton">
<img src="image.jpg"/>
<p>This is a long explaination of the image on the left.</p>
</a>
I commented the code, so it should be obvious what I am doing. However, if you have any questions just let me know.
Jeremy A. Snyder
snydersoft.com | Sharing Web Development Information