homepage Welcome to WebmasterWorld Guest from 23.22.217.122
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / CSS
Forum Library, Charter, Moderators: not2easy

CSS Forum

    
Relative positioning does not wor
fendy




msg:3729133
 8:28 pm on Aug 22, 2008 (gmt 0)

I am trying to use css instead of table but i wasnt to align divs perfectly and thy should be centered so I used relative positioning

I have 2 layers and put them into the wrapper

layer 1 is kind of positioned good, layer 2 is way below

here is the code

#wrapper { width:800px;
height:800px;
background-color:#0000FF;
margin:0 auto 0 auto;
padding:0px;

}

#layer1 {
width:250px;
height:400px;
background-color:#ccc;
position:relative;
left:500px;
top:50px;
overflow: auto;
padding:20px;
}

#layer2 {
width:150px;
height:600px;
background-color:#bbb;
position:relative;
left:100px;
top:100px;
overflow: auto;
padding:10px;
float:left;
}

I mean there should be polace for each layer to display and layer 1 has top 50 and actually it is displayed 70 px from top

and layer 2 is also top 100 px but has actualy at least 560 px top, left is positioned ok

here is the html

<div id="wrapper">
<div id="layer1"></div>
<div id="layer2"></div>
</div>

 

fendy




msg:3729134
 8:29 pm on Aug 22, 2008 (gmt 0)

and the whole html code is here
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
<!--
#wrapper { width:800px;
height:800px;
background-color:#0000FF;
margin:0 auto 0 auto;
padding:0px;

}

#layer1 {
width:250px;
height:400px;
background-color:#ccc;
position:relative;
left:500px;
top:50px;
overflow: auto;
padding:20px;
}

#layer2 {
width:150px;
height:600px;
background-color:#bbb;
position:relative;
left:100px;
top:100px;
overflow: auto;
padding:10px;
float:left;
}
-->
</style>
</head>

<body><div id="wrapper">kkk

<div id="layer1">This web site contains nudity and depictions of graphic sexual material, including explicit depictions of sexual conduct and other materials for mature adult viewers only. This web site contains age-restricted materials and access is limited to adults only. If you are over the age of 18 years or otherwise over the age of majority in the location from which you have accessed this web site, you may enter this web site and access our computers and data ONLY if you agree to, and comply with, all the <a href="http://www.feliciatang.com/terms.html">TERMS AND CONDITIONS</a> for use of the web site set computers and data in our databases. Any such access to our computers and our data in excess of the permission we give you violates state, federal and foreign laws, including, without limitation, The Electronic Communications Privacy Act, 18 U.S.C. §§ 2701-2710, The Computer Fraud and Abuse Act, 18 U.S.C. § 1030 and The California Comprehensive Computer Data Access and Fraud Act, Cal. Penal Code §502. Unauthorized access to this web site also constitutes one or more intentional infringements of our copyrights in the materials depicted on our web site. If you are under the age of 18 years, or under the age of majority in the location from where you are accessing this message, you do not have authorization or permission to enter this web site or access any of its materials. Consequently if you are under the age of 18 years and proceed further you will be engaged in the unauthorized access of our computers and data in our computers and infringement of our copyrights.</div>
<div id="layer2">computers and data in our databases. Any such access to our computers and our data in excess of the permission we give you violates state, federal and foreign laws, including, without limitation, The Electronic Communications Privacy Act, 18 U.S.C. §§ 2701-2710, The Computer Fraud and Abuse Act, 18 U.S.C. § 1030 and The California Comprehensive Computer Data Access and Fraud Act, Cal. Penal Code §502. Unauthorized access to this web site also constitutes one or more intentional infringements of our copyrights in the materials depicted on our web site. If you are under the age of 18 years, or under the age of majority in the location from where you are accessing this message, you do not have authorization or permission to enter this web site or access any of its materials. Consequently if you are under the age of 18 years and proceed further you will be engaged in the unauthorized access of our computers and data in our computers and infringement of our copyrights.</div>

</div>
</body>
</html>

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / CSS
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved