views:

51

answers:

4
    </div>

<div style="position:absolute;top:160px;left:535px;"><img src="splash.png"></div>
<div style="position:absolute;top:160px;left:535px;"><img src="splash2.png"></div>
<div style="position:absolute;top:160px;left:535px;"><img src="splash3.png"></div>
<!-- Press Logos -->
<div align="center">

how can i get all three splash images to display horizontally...

+1  A: 

You could

  • Give each div a different x position (the most straightforward way, really)

  • Put them into a container of sufficient width and give the container position: absolute instead of the surrounding divs

Pekka
what Y position would you recommend, or do i just have to guess and check..
adam
Sorry, the Y position can stay the same. Corrected.
Pekka
so change the 535 or the 160? and what would you recommend changing htem to?
adam
Change the `535` to `535 + the width of the images before + the width of the current image`. Just try it out!
Pekka
+1  A: 

Try changing your code to look like:

<div style="position:absolute;top:160px;left:535px;">
    <img src="splash.png"><img src="splash2.png"><img src="splash3.png">
</div>
Eli
+1  A: 

By 'Display horizontally', do you mean they sit next to each other on one line? Images in markup will do this naturally unless there is not enough room, in which case they wrap to space below.

<div>
    <img src="splash.png" />
    <img src="splash2.png" />
    <img src="splash3.png" />
</div>

You can apply styling to the surrounding div to position the images centered, etc.

Additionally, your original markup example has some bad markup. Your image tags should be self-closing (I.e. ending in />, not >).

KP
http://neighborrow.com/this answer got all three to display but not in the right spot on the page... they are supposed to go in the right half of the page across from the search
adam
The `<img>` tag does not need to be self closing unless it's XHTML.
Gazzer
@Gazzer: Fair enough. I always develop XHTML markup so habit I guess. I still think it's worth it for readability. Scanning tags visually is easier when you can recognize start and end tags quickly...
KP
@adam: Yes I was just explaining that images will display inline. Your original question didn't specify exactly where they should fall on the page, only that they sit side by side. This is why I recommended adding styling to the surrounding div to position the group where you need...
KP
I certainly don't think that the extra effort of typing a couple of symbols plus the extra data that has to be downloaded is worth the effort for readability :-)
Gazzer
I could also argue that XHTML is far better solution than good ol' fashion HTML, but that's for another day... (:
KP
+1  A: 

You can also use floats:

#header
{
     height: 100px; /*or something */
 }
#header img
{
      float: left;
      margin: 20px; /*change the margin(s) as you need */
}
Gazzer