Sent by Porter Glendinning on 27 February 2002 14:02
At 13:44 2/27/02, E. Jordan Bojar digitized these thoughts:
>Although I've worked extensively with CSS2's typographic features, I can't
>seem to figure out how to center a single image horizontally and vertically
>on a single page. Is there a simple trick for this I've missed somewhere?
Give this a try:
#centeredImage {
width: 100px;
height: 100px;
position: absolute;
top: 50%;
left: 50%;
margin: -50px 0 0 -50px;
padding: 0;
}
<div id="centeredImage"><img ... width="100" height="100" ... ></div>
If all you need to do is center an image on the viewport, that should
do it for you. Obviously, adjust the width, height, and margin
properties to suit your needs.
- Porter
+--------------------------------------------------------+
| Porter Glendinning [EMAIL-REMOVED] |
| Web/UI Commando http://www.glendinning.org |
+--------------------------------------------------------+
| Porter's Workshop - http://www.serve.com/apg/workshop/ |
+--------------------------------------------------------+