PDA

View Full Version : Images in div are seperated.



BarrMan
Sep 2nd, 2007, 03:55 PM
Hey, I've changed my code from tables to divs but now that I don't have the cellpadding-cellspacing functions I have no idea how to define no spaces between the images.
Here's an example:
www.emree.net/example/as.html
How can I make the images tied up to each other?

Thanks.

ahallicks
Sep 2nd, 2007, 08:26 PM
I know you are using a very simplified page there, but you still need a valid doctype! Start with putting one of those in and then I think you need to explain exactly what you want to happen on that page. I see you have put two images in there, but you've not explained exactly how you want them placed or anything? If you want the images to be displayed side-by-side you'll need to use img {display: block;} in your stylesheet, float them left, or remove the space in your code so that the image code is next to each other such as:

<img src="images/poll.jpg" height="25" width="60" /><img src="images/poll_left.jpg" height="25" width="131" />

coothead
Sep 2nd, 2007, 09:53 PM
Hi there BarrMan,

here is ahallicks' suggestion of floating put into code...

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title></title>
<base href="http://www.emree.net/example/">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<style type="text/css">
#mydiv {
width:200px;
height:150px;
background-color:rgb(240, 240, 240);
float:right;
}
#poll {
width:60px;
height:25px;
margin-right:4px;
float:right;
}
#poll_left {
width:131px;
height:25px;
float:right;
}
</style>

</head>
<body>

<div id="mydiv">
<img id="poll" src="images/poll.jpg" alt=""/>
<img id="poll_left" src="images/poll_left.jpg" alt=""/>
</div>

</body>
</html>
coothead