Code2Design.com

User login

The Layout

Programming

Graphic Design

Resources

Navigation

C2D Projects

Unsystematic Affiliates

Christian Cosmos DNSandIP Photoshop Cafe Pixel Depth 

Change Language

Who's online

There are currently 0 users and 7 guests online.

Another way to do ABSMIDDLE with CSS?

I'm just checking up my website, www.creaturefeature.info, with validator.w3.org, and apparently the align="absmiddle" function is not supported on all browsers. Is there a way to do something similar with CSS to avoid some browsers not supporting it?


Submitted by Ataru on November 24, 2007 - 2:18pm.
printer friendly version

absmiddle

I have never even heard of anything like "absmiddle". However, I take it that it stands for "absolute middle". If so, one of the following will work:

<center><p>Old HTML style center</p></center>


<div style="margin: 0px auto; width: 100px;">
CSS center
</div>


"absmiddle" is not a standard attribute

"absmiddle" is a proprietary attribute for vertical centering which is why it isn't supported by all browsers. The closest you could get in CSS would probably be to use "vertical-align:middle".

<img src="my-image.png" style="vertical-align:middle">


absmiddle

Actually, vertical-align:middle puts the center of an image at 1/4 em above the text baseline, not at the center of the line height. This doesn't match what absmiddle looks like. I have found the following CSS to approximate 'absmiddle' better:

IMG.absmiddle {
vertical-align: middle;
margin-bottom: .25em;
}

You might be tempted to adjust the top margin by -.25em so as not to muck with the line height, but this can cause problems with elements above, such as lines in tables, so I don't do it.


Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <br> <br /> <h3>
  • Lines and paragraphs break automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • You can use BBCode tags in the text, URLs will be automatically converted to links
More information about formatting options



Like what you see?

Why not add more? C2D is looking for other Christian Web Masters who would like to help write articles for this site. If you have expericance in FLASH, CSS/HTML, PHP/MySQL, PhotoShop/GIMP, Blender, Javascript, or just General Design - our users would love to hear what you have to say. Contact Us

delicious   digg   reddit   magnoliacom   newsvine   furl   google   yahoo   technorati