Forum Moderators: not2easy
<div id='column2'>
<h1>Centered Image</h1>
<div class="centerscreenshot"><img src="../../images/centeredimage.gif" alt='centeredimage'/></div>
<div class='breadcrumb'>
<a href='widget.htm'>Back to Specifications</a>
</div>
</div><!-- end column2 -->
css:
.centerscreenshot img {
min-height: 10em;
display: table-cell;
vertical-align: middle;
margin-bottom: 20px;
}
Perhaps some of it might help you.
Bottom line of what I found: It sucks.
There is an obvious standard way to center stuff vertically: auto margins.
A second trick: "
position: absolute; top: 0; right: 0; bottom: 0; left: 0;", it might not be usable in tables, hard to say as I don't do tables unless I have to represent tabular or matrix data. For IE a centered image on the background worked somewhat, but it was far from optimal.
The code I used for a few weeks:
(donating it to the public domain, feel free to use):
index.html:
--->8---
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>example</title>
<link rel="stylesheet" type="text/css" href="css.css" />
<!--[if IE]>
<link rel="stylesheet" type="text/css" href="ie.css" />
<![endif]-->
</head>
<body>
<h1>Welcome</h1>
<img id="mainlogo" src="logo.gif" alt="LOGO" />
</body>
</html> css.css:
--->8---
* {margin: 0; font-family: Verdana, Arial, Helvetica, sans-serif;}
body {background-color: rgb(255,128,0); color: black; text-align: center;}
h1 {font-size: 16pt}
#mainlogo { position: absolute; top: 0; right: 0; bottom: 0; left: 0; width: 359px; height: 498px; margin:auto; } ie.css:
--->8---
body {background-position: center center; background-image: url(logo.gif); background-repeat: no-repeat; height: 600px}
#mainlogo {display:none} I'm sure it can be done better, but I had little time and
as long as it had the look the customers want it was good.
[edited by: Xapti at 4:51 am (utc) on Feb. 4, 2008]