Jump to content

Center Webpage


podarum
 Share

Recommended Posts

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>Vertically and Horizontally Centering a DIV</title><meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /><script type="text/javascript" src="/mint/mint.js.php"></script><style type="text/css">body {	font-size: 12px;	font-family: arial, helvetica, sans-serif;	color: #333;}p {	margin: 1em;}.comments {	background-color: #e3e3e3;	border-top: 1px solid #ccc;	border-bottom: 1px solid #ccc;	padding: 2px;}#mydiv {	position:absolute;	top: 50%;	left: 50%;	width:30em;	height:18em;	margin-top: -9em; /*set to a negative number 1/2 of your height*/	margin-left: -15em; /*set to a negative number 1/2 of your width*/	border: 1px solid #ccc;	background-color: #f3f3f3;}</style></head><body><div id='mlk' class='menu' style='position:absolute;top:-10000px;left:-10000px;'></div><img height="1" width="1" alt="" src="http://e1.extreme-dm.com/s10.g?login=nahuibly&j=n&jv=n" /><div id="mydiv">	<p>This is a vertically and horizontally centered <div> tag. Try resizing your browser.</p>		<div class="comments">		<p><strong>Comments:</strong></p>		<p>Tested in: <span style="color: darkblue">Firefox, IE6, Opera 7, NN4.7, NN7, and Mozilla 1.2.</span><br />		Works in: <span style="color: darkblue">Firefox, IE6, Opera 7, NN7, and Mozilla 1.2.</span><br />		Doesn't work in: <span style="color: darkblue">NN4.7</span></p>		<p>© Copyright 2003, <a href="/">Infinity Web Design</a></p>	</div></div></body></html>

Above is the code that this guy used for that example.When you are looking to see the code of the page you should click ----> View / Page Source (browsers tabs) and you will see the code of the page you are looking in browser.

Edited by multiLady
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...