Forum Moderators: not2easy
I don't really need this in a table, I just used it to get the images to be in the correct position. What I want it to look like is:
image image image
<table align="center" cellspacing="0" cellpadding="0" border="0" width="573">
<tr>
<td width="191" align="left">
<a href="http://www.example.com/advertise.html"><img src="http://www.example.com/images/adslink.gif" border="0"></a>
</td>
<td width="191" align="center">
<a href="http://www.example.com/archive.html"><img src="http://www.example.com/images/archivelink.gif" border="0"></a>
</td>
<td width="191" align="right">
<a href="http://www.example.com/contact.html"><img src="http://www.example.com/images/contactlink.gif" border="0"></a>
</td>
</tr>
</table>
Any help would be so appreciated!
[edited by: eelixduppy at 2:27 am (utc) on Dec. 9, 2008]
[edit reason] exemplified [/edit]
<DIV class="box">
<A HREF="" title=""><img src="" alt=""></A>
<A HREF="" title=""><img src="" alt=""></A>
<A HREF="" title=""><img src="" alt=""></A>
</DIV>
.box
{
width: 573px;
margin: 0px;
padding: 0px;
}
.box img
{
float: left;
width: 91px;
margin: 0px;
}
Also, you can float left or right, but not center. So if your div is wider than the total of your floated images, positioning them in the center may require margins or padding. But here is a neat trick i've gotten a lot of mileage out of lately.
.box
{
display: inline;
text-align: center;
width: 573px;
margin: 0px;
padding: 0px;
}
.box img
{
width: 91px;
margin: 0px;
}
There is also absolute positioning, which you might like more. However, I haven't used this much at all and so can't advise you properly.
w3schools is a website with a very good html and css reference and tutorials which allow you to play with the code. In tandem with webmasterworld, it's a great way to learn to code !
caveat- I too am on a Mac and rarely have the opportunity to check my code in IE (but I keep Mac IE 5.2 around to break my pages against, so I'm feeling pretty confident that this simpler stuff will work across the board.). After reading about all the hacks and workarounds and conditional statements for IE, I try to avoid pixel perfect layout, and leave the 'joints' loose, and pray :)
[edited by: commanderW at 6:47 am (utc) on Dec. 9, 2008]
image image image
didn't format correctly.
I want the first image on the left, the second image in the center and the third image on the right...with about 100 px margin on left and right.
When I tried your recommended CSS, the first image increased in size and the last 2 decreased in size. I modified the width and margin and was able to get the first image to appear correctly, but the second 2 were still very small and right next to the 1st.
Any suggestions? Thanks again!
and a warm welcome to these forums. ;)
Try it like this...
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Style-Type" content="text/css">
<meta http-equiv="Content-Script-Type" content="text/javascript"><style type="text/css">
#box img {
width:191px;[red]
/* this border value is only for the example and should be set to 0;*/[/red]
border:1px solid #000;
}
#right{
float:right;
margin-right:100px;
}
#left{
float:left;
margin-left:100px;
}
#center {
display:block;
margin:auto;
}
</style></head>
<body><div id="box">
<a href="#" title=""><img id="right" src="right_image.jpg" alt="right"></a>
<a href="#" title=""><img id="left" src="left_image.jpg" alt="left"></a>
<a href="#" title=""><img id="center" src="center_image.jpg" alt="center"></a>
</div></body>
</html>