Help - Search - Members - Calendar
Full Version: Centering images
Forums > Resource Center > Webmasters' Corner > Webmasters' Corner Resolved Topics
novemberwind
This is kind of weird, and I don't know quite how to phrase it.

I have a layout that I want RIGHT in the middle of the page. My first attempt ended up like this: Here.

I've changed the layout, and I know how to center stuff HORIZONTALLY (of course), but I also want it centered VERTICALLY no matter what size the browser is. Is that possible with more than just an image (say, with several images and an iFrame put on top of the images?)

Not sure if that makes sense, but I hope someone replies soon _unsure.gif
novemberwind
oops, double post
lovescream
UHHHH.. I think I get what you're saying..?
Can you try aligning vertically with 50% or something as position?
novemberwind
Well, I got SOMETHING working.

This is an abbreviated version of my code, involving only the elements that deal with vertical centering:

CODE
<HTML>
<head>
<style type="text/css">
div#centered { border: 0; height: 50%; width: 50%;
position: absolute; left: 25%; top: 25%; }
</style>

</HEAD>
<BODY background="http://img176.imageshack.us/img176/6640/bgenterfv6.jpg">
<center>
<div id="centered">
<img src="http://img245.imageshack.us/img245/7481/entertopleftnp8.gif"><img src="http://img177.imageshack.us/img177/9003/entertopmiddleno5.jpg"><img src="http://img184.imageshack.us/img184/1107/entertoprightlq1.gif"><br>
<img name="enter_middle" src="http://img520.imageshack.us/img520/8884/entermiddlegl5.jpg" width="550" height="280" border="0" id="enter_middle" usemap="#m_enter_middle" alt="" /><br>
<img src="http://img177.imageshack.us/img177/5096/enterbottomleftwu5.gif"><img src="http://img522.imageshack.us/img522/4106/enterbottommiddlesp4.jpg"><img src="http://img245.imageshack.us/img245/2968/enterbottomrightev7.gif">
</div>
</center>
</body>
</html>


My problem is that with this kind of method, if the window gets to small, the images don't stay side by side anymore D:
LeCouture
uhhh..i don't get it. sweating.gif
Smarmosaur
Uhmmm, I don't know if this is what you're looking for, or if it will help, but put this BEFORE the code that you need aligned...I'm guessing you know DIV's, so this is just basically one big DIV that you can use to move the entire object. Change 0 to whatever you want...

CODE
<div style="left:0px; top:0px; position=absolute;">


Hope this helps a little.
ermm.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.