...

View Full Version : How Do I Place Two Images Next To Each Other?



Mehdi72
08-01-2007, 01:15 AM
Here I have two images :

h**p://soccer-europe.com/newindex.html

I want them displayed next to each other. How do I do it?

Here's the relevant HTML :



<div id="image1">
<img src="Graphics/Photos/flickr/2_April_2007_Milan_by_superleague_formula_thebeautifulrace.jpg" width="500" height="334">
<img src="Graphics/Photos/flickr/5_July_2007_Carlos_Tevez_by_dentough.jpg" width="300" height="410">
<div id="cap"> 2007 Superleague Formula</div>
</div>


and the relevant css :



#image1 {
float: left;
padding-right: 10px;
}

#image2 {
float: right;
padding-left: 10px;
}

_Aerospace_Eng_
08-01-2007, 01:22 AM
#image1 img {
float:left;
}
#cap {
clear:both;
}
Though your current code may prevent the images from going next to each other. I say this because your code is highly invalid. See your coding errors here (http://validator.w3.org/check?verbose=1&uri=http%3A%2F%2Fsoccer-europe.com%2Fnewindex.html). The server to the url I just posted may be down at the moment. When its back up it will show you your coding errors.

Mehdi72
08-01-2007, 01:36 AM
I'm playing around with a template from another website that's why the code is a bit of a mess.

Mehdi72
08-01-2007, 05:21 PM
#image1 img {
float:left;
}
#cap {
clear:both;
}
Though your current code may prevent the images from going next to each other. I say this because your code is highly invalid. See your coding errors here (http://validator.w3.org/check?verbose=1&uri=http%3A%2F%2Fsoccer-europe.com%2Fnewindex.html). The server to the url I just posted may be down at the moment. When its back up it will show you your coding errors.

I've tidied up most of the code but the css you listed didn't work.

Jutlander
08-01-2007, 05:32 PM
The code Aero provided works fine when I test it? You didn't use the #image2 did you, because it isn't needed, as the code above suggests.

Mehdi72
08-01-2007, 06:34 PM
The code Aero provided works fine when I test it? You didn't use the #image2 did you, because it isn't needed, as the code above suggests.

Yes I did, fixed now but the problem is :

http://soccer-europe.com/newindex.html

I want to add text under each image and add a margin to space out the images. I added a 2px margin in the css but it returned the second image to the next line.

Mehdi72
08-02-2007, 11:41 PM
Resolved.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum