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?
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 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">
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.