waynemac Posted December 1, 2004 Posted December 1, 2004 Gidday all, Im wanting to align an image in the center (vertical and horizontal) of the user's browser window. How would I go about this? Using XHTML. Regards, Wayne Quote
LisaJill Posted December 1, 2004 Posted December 1, 2004 Check out this site and other possible ways of doing this are listed here. =) Quote
KungFòóFairy Posted December 1, 2004 Posted December 1, 2004 Oft methinks the ostensible omniscience of google scary. :Nerd: Quote
kaseytraeger Posted December 1, 2004 Posted December 1, 2004 I would use CSS rather than XHTML. To align an image in the middle of the browser window, I always use the following. ><img src="location/of/your/image.gif" alt="Some image text" style="margin: 0 auto;" /> This should center the image nicely. Description of margin is a shorthand rule that says, "make the top and bottom margin of the image 0 pixels tall, and automatically determine the left and right margins." When the auto determination is made, the margins will be set to the same width using the formula: width (of left or right margin) = (browser_width - image_width)/2 (If my algebra skills are still up to par.) Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.