...

View Full Version : Ul positioning question



cssmaker
02-15-2012, 01:27 AM
Hello I was wondering can use both I static and relative together for positioning in this code.
#header ul{
position:static;
top: 40px;
left: 20px;
display: inline;
margin: 0;
padding: 0;
}

Excavator
02-15-2012, 01:49 AM
Hello cssmaker,
Did you try that at all?
Make a test .html and see if the top/left coordinates have any affect on the ul.


<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
html, body {
margin: 0;
background: #fc6;
}
#container {
width: 800px;
margin: 30px auto;
background: #999;
position: relative;
}
ul {
position:static;
top: 40px;
left: 20px;
display: inline;
margin: 0;
padding: 0;
}
</style>
</head>
<body>
<div id="container">
<ul>
<li>linky</li>
<li>linky</li>
<li>linky</li>
<li>linky</li>
</ul>
<!--end container--></div>
</body>
</html>

cssmaker
02-15-2012, 02:04 AM
Thanks,
I just want to know if static and relative positioning can be used together in the code that I posted.
#header ul{
position:static;<-- This one how can I change it to use both static and relative?
top: 40px;
left: 20px;
display: inline;
margin: 0;
padding: 0;
}

Excavator
02-15-2012, 02:14 AM
http://www.w3schools.com/cssref/pr_class_position.asp

relative :
The element is positioned relative to its normal position, so "left:20" adds 20 pixels to the element's LEFT position

In this example the ul is not any different than static (default) with some margin applied -
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
html, body {
margin: 0;
background: #fc6;
}
#container {
width: 800px;
margin: 30px auto;
background: #999;
position: relative;
}
#box {
height: 200px;
width: 200px;
background: #f00;
}
ul {
postion: relative;
top: 40px;
left: 20px;
display: inline;
margin: 0;
padding: 0;
}
</style>
</head>
<body>
<div id="container">
<div id="box"></div>
<ul>
<li>linky</li>
<li>linky</li>
<li>linky</li>
<li>linky</li>
</ul>
<!--end container--></div>
</body>
</html>

cssmaker
02-15-2012, 02:34 AM
[QUOTE=Excavator;1193342]Hello cssmaker,
Did you try that at all?
Make a test .html and see if the top/left coordinates have any affect on the ul.

The top/left coordinates do not move it

Excavator
02-15-2012, 02:51 AM
[QUOTE=Excavator;1193342]Hello cssmaker,
Did you try that at all?
Make a test .html and see if the top/left coordinates have any affect on the ul.

The top/left coordinates do not move it

That was my point.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum