[Solved] CSS centering

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
xEzMikex
Forum Commoner
Posts: 38
Joined: Sat Jan 21, 2006 10:18 pm
Location: Canada

[Solved] CSS centering

Post by xEzMikex »

ok well im using CSS now instead of tables in my php tutorial system witch will be realeased soon... HERE FIRST!!!! anyways i got some questions on CSS hoping somone here can help me.

1.How do i center CSS (i know about the div.container{} thing} and is there away so the size of things doesnt change? when you minimize and stuff
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

The easiest (imho) method to "center" align something is the following:

Code: Select all

div#centerme {
  margin: auto;
  width: 500px;
}
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post by m3mn0n »

Moving this to Client Side so it's in the proper forum.
xEzMikex
Forum Commoner
Posts: 38
Joined: Sat Jan 21, 2006 10:18 pm
Location: Canada

Post by xEzMikex »

it just moves to the left.... heres my code

Code: Select all

<html>
<head>
<title>Untitled Document</title>
</head>
<style>
	div.pack{
	background:#000000;
	color:#FFFFFF;
	position:relative;
	left:25%;
	width:50%;
	}
    div.banner{
	background:#1C710D;
	color:#33FF33;
	margin:auto;
	position:absolute;
	height:100px;
	width:700px;
	} 
</style>
<body>


<div class="banner">
Banner Here
</div>

	
</body>
</html>














GOT IT THANKA!
Post Reply