• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 4988
  • Last Modified:

Absolute Middle Alignment for Images

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
REA_ANDREW
Asked:
REA_ANDREW
  • 2
1 Solution
 
nltechCommented:
0
 
nltechCommented:
0
 
radnorCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now