?
Solved

Absolute Middle Alignment for Images

Posted on 2006-05-10
3
Medium Priority
?
4,981 Views
Last Modified: 2008-03-06
Hi,

I have the attribute

align="absmiddle" in an image tag. Unfortunately with XHTML Strict, this is not allowed. Can anyone please tell me the CSS equivalent.

I know that

vertical-align:absmiddle is not valid in cSS

and that

vertical-align:middle does not give the desired effect. Thank you
0
Comment
Question by:REA_ANDREW
  • 2
3 Comments
 
LVL 14

Expert Comment

by:nltech
ID: 16646795
0
 
LVL 14

Expert Comment

by:nltech
ID: 16646810
0
 
LVL 8

Accepted Solution

by:
radnor earned 2000 total points
ID: 16648944
Well....

get the image size.

write this out as a style sheet:

<style>
.img_style {
   position: absolute;
   left: 50%;
   margin-left: - (WIDTH/2);
   top: 50%;
   margin-top: - (HEIGHT/2);
</style>

<img class="img_style" src="....." />

The left and top margins are NEGATIVE numbers (one half the size).

Try that and see.....
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a how to build your own CSS3 slideshow and when I say CSS3 I mean just CSS with no javascript in sight! There a few examples online of how to do this but most just show you an example without any explanation, others make it more complicat…
This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
Suggested Courses
Course of the Month17 days, 9 hours left to enroll

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question