Pages: [1]
  Print  
Author Topic: CSS Position:Absolute problem  (Read 77 times)
Hermionee
Jr. Member
**
Offline Offline

Posts: 85



View Profile
« on: November 18, 2008, 09:56:28 AM »

hey guys im using Absolute position divs to design my website. but i want it to placed in the center of the screen with the CSS absolute positioning i set. how can i do this?
Logged


slayer
Administrator
Jr. Member
*****
Offline Offline

Posts: 76


To be an Expert be with Experts!


View Profile
« Reply #1 on: November 18, 2008, 10:08:32 AM »

its pretty simple. you just have to use Position:Relative in the Container div and wrap a <center> tag around it. check this example

CSS Style Sheet:

Code:
<style type="text/css">
.container{
position:relative;
width:800px;
background:#CCCCCC;
height:400px;
text-align:left;
}
.div1{
position:absolute;
width: 260px;
height: 177px;
left: 121px;
top: 122px;
background-color:#666666
}
</style>


HTML Code:

Code:
<center>
<div class="container">
<div class="div1"> </div>
</div>
</center>
Logged

MaxPayne
Jr. Member
**
Offline Offline

Posts: 57


I dont believe the heaven, But i Do believe Angels


View Profile
« Reply #2 on: November 22, 2008, 09:48:57 AM »

well described. also you can use tables for layout the website but its not recommended.
Logged


hitman
Jr. Member
**
Offline Offline

Posts: 52



View Profile
« Reply #3 on: November 23, 2008, 12:14:11 AM »

using tables for layouting is an old fashion dude.
Logged


Hermionee
Jr. Member
**
Offline Offline

Posts: 85



View Profile
« Reply #4 on: November 23, 2008, 01:31:58 AM »

ya guys. i dont like to use tables. thanks slayer for the help. its working..  Smiley Smiley
Logged


Pages: [1]
  Print  
 
Jump to: