glenmac
02-21-2005, 04:36 PM
I'm trying to set up a page using CSS positioning. Not haveing much success.
I want to have the elements positioned the same in 800X600 as 1024X768 resolution. I've used percentages for the size of the elements and that works fine, but I was wondering if you can use percentages for relative positioning. Obviously using pixels won't work. I've tried. Does anyone know how to position my elements relative to the screen size, or if anyone can help me with my problem it would be much appreciated.
Here's my code to date;
<html>
<head><title> test</title>
<style>
#first{
width:20%;
height:15%;
background:red;
position:relative;
top:20px;
left:80px;
}
#second{
width:50%;
height:40%;
background:green;
position:relative;
top:-30px;
left:150px;
z-index:1;
}
#third{
width:20%;
height:15%;
background:blue;
position:relative;
left:530px;
top:-70px
}
html{
background:yellow;
}
</style>
</head>
<body scroll="auto">
<div id = "first"> first</div>
<div id = "second">second</div>
<div id = "third">third</div>
</body>
I want to have the elements positioned the same in 800X600 as 1024X768 resolution. I've used percentages for the size of the elements and that works fine, but I was wondering if you can use percentages for relative positioning. Obviously using pixels won't work. I've tried. Does anyone know how to position my elements relative to the screen size, or if anyone can help me with my problem it would be much appreciated.
Here's my code to date;
<html>
<head><title> test</title>
<style>
#first{
width:20%;
height:15%;
background:red;
position:relative;
top:20px;
left:80px;
}
#second{
width:50%;
height:40%;
background:green;
position:relative;
top:-30px;
left:150px;
z-index:1;
}
#third{
width:20%;
height:15%;
background:blue;
position:relative;
left:530px;
top:-70px
}
html{
background:yellow;
}
</style>
</head>
<body scroll="auto">
<div id = "first"> first</div>
<div id = "second">second</div>
<div id = "third">third</div>
</body>