View Full Version : div centered
lord22
11-16-2009, 08:08 PM
Hi,
I have a div with image inside. On every page there is a different image in it, with different size. I want this div to be placed horizontally and vertically in the center of the screen, how can I do it?
davelf
11-17-2009, 02:21 AM
the easiest way is using
<div align="center">
<div>
(this div is centered)
</div>
</div>
or you can read this:
css/center (http://www.bluerobot.com/web/css/center1.html)
boogyman
11-17-2009, 06:08 PM
the easiest way is using
<div align="center">
<div>
(this div is centered)
</div>
</div>
or you can read this:
css/center (http://www.bluerobot.com/web/css/center1.html)
Terribly wrong!!! (X)HTML should never be used for presentational purposes.
Review the following
div {
position: absolute;
top: 50%;
left: 50%;
width: 300px;
height: 300px;
margin: -150px 0 0 -150px;
}
img {border:none}
<div><img src="/folder/file.jpg" alt="textual representation of the content of the image"></div>
davelf
11-18-2009, 05:03 AM
ups, sorry.
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.