Forum Moderators: open
<a href="http://www.mysite.com/Merchant2/merchant.mvc"><img src="images/addtocart.gif"</p>
<p><br>
$39.99<br>
<span class="style8"> </span><br>
<br>
Does anyone know why the price is being included in the link? I'm a newbie at this so sorry if this is such a simple question.
Thanks!
1) I would like the text to be larger
2) I would like the text to show up on right side at a little distance from the image. It should look something like this:
(IMAGE) $39.99
Here is the text that I currently have:
<a href="http://www.alloutnutrition.com/Merchant2/merchant.mvc?Screen=PROD&Store_Code=AON&Product_Code=NL"><img src="images/addtocart.gif" alt=""/></A>
<p>$39.99</p>
<span class="style8"></span><br>
<br>
<br>
</p>
</div>
Any ideas how I could fix this?
.price {
font-size: 1.2em; /* set your font size */
padding-left: 2em; /* add space on the left */
}
Then use it when you want to display the price text.
<a href="http://www.alloutnutrition.com/Merchant2/merchant.mvc?Screen=PROD&Store_Code=AON&Product_Code=NL"><img src="images/addtocart.gif" alt=""/></A>
<p class="price">$39.99</p>
<span class="style8"></span><br>
<br>
<br>
</p>
</div>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
<style type="text/css">
.price {padding: 1em 10px; display:inline; font-size: 1.2em; font-weight: bold;}
</style>
</head>
<body>
<div> <a href="http://www.mysite.com/Merchant2/merchant.mvc"><img src="images/addtocart.gif" alt="" /></a>
<p class="price">$39.99</p>
</div>
</body>
</html>
This will do what you've asked for. However, the text will be inline with the base of the image.
To move the text up, you can add somehting like:
position:relative; top:-10px
to the .price part.
Another option you have (which a lot of people don't like to talk about) is a table.
Something like this:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
<style type="text/css">
table {width:200px}
td {vertical-align:middle; text-align: center; font-size: 1.2em; font-weight: bold;}
</style>
</head>
<body>
<table>
<tr>
<td><a href="http://www.mysite.com/Merchant2/merchant.mvc"><img src="images/addtocart.gif" alt="" /></a>
</td>
<td>$39.99
</td>
</tr>
</table>
</body>
</html>
It's not quite as... small as the top one, but it will automatically vertically centre your text.
There are other ways, but these work (if it's just one picture - I'd go with the top one. If you have a few of these with different sized pictures, I'd probably use the table - although I might regret saying that...)
Cheers,
Cook