Click to See Complete Forum and Search --> : Positioning


shane.carr
09-14-2006, 10:47 PM
Okay, I never took a class nor a tutorial on CSS, so this should be a very easy question:

<!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=ISO-8859-1" />
<link rel="stylesheet" href="styles.css" type="text/css" />
<title>Test</title>
</head>
<body>
<div id="top"><h1>Test</h1></div>
<div id="log"><p>Lorem ipsum dolor sit amet</p>
<p>Lorem ipsum dolor sit amet</p></div>
<ul id="nav_left">
<li style="display:inline; background:none; border:none;">Test:</li>
<li>Op1</li>
<li class="sel">Op2</li>
</ul>
<div id="forumdiv">
<h2>Test</h2>
<table id="forums">
<tr><th>Header1</th><th>Header2</th></tr>
<tr><td>test</td><td>test</td></tr>
<tr><td>test2</td><td>test2</td></tr>
</table>
</div>
</body>
</html>

and the entire CSS:

body{
width:750px;
font-family:Verdana, Arial, Helvetica, sans-serif;
margin:0 auto;
padding-top:5px;
}
#top h1{
padding:10px 50px 10px 50px;
font-size:36px;
}
#log{
border:1px solid #333333;
background:#6699CC;
padding:5px 5px 5px 5px;
width:175px;
font-size:10px;
line-height:14px;
}
#log h5{
margin:0px 0px 0px 0px;
padding:0px 0px 0px 0px;
font-size:12px;
}
#log label{
font-size:10px;
}
#log form{
display:inline;
}
#user,#pass{
display:inline;
width:100px;
}
#nav_left{
padding:25px 0px 10px 10px;
float:left;
list-style:none;
}
#nav_left li{
list-style:none;
border:1px solid #333333;
width:150px;
height:18px;
font-size:12px;
line-height:18px;
vertical-align:middle;
margin:5px;
text-align:center;
background:#666699;
}
#nav_left li.sel{
font-weight:bold;
background:#996666;
}
#log a{
color:#0000FF;
}
#log a:active{
color:#FF0000;
}
#forums{
border:none;
margin:0px 0px 0px 0px;
padding:0px 0px 0px 0px;
font-size:10px;
}
#forums td, #forums th{
padding:2px 2px 2px 10px;
}
#forumdiv{
margin:0px 5px 5px 200px;
border:dashed thin green;
width:200px;
position:absolute;
}

Just the important CSS:

body{
width:750px;
margin:0 auto;
}
#top h1{
padding:10px 50px 10px 50px;
font-size:36px;
}
#log{
background:#6699CC;
width:175px;
}
#nav_left{
padding:25px 0px 10px 10px;
float:left;
list-style:none;
}
#nav_left li{
width:150px;
height:18px;
margin:5px;
}
#forums td, #forums th{
padding:2px 2px 2px 10px;
}
#forumdiv{
margin:0px 5px 5px 200px;
border:dashed thin green;
width:200px;
position:absolute;
}

How do I make the div with the green border be positioned parallel to the top of the blue box instead of the bottom? and if I were to add a list navigatin bar going accross the top, then how do I adapt it?

It's not really very much code, the forum just displays it in a huge font to make it look like a lot :rolleyes:

drhowarddrfine
09-15-2006, 01:21 AM
Just add float:left; to your log div. But this will mess up the positioning of the table below that. Perhaps you know how to fix that? (Cause I'm too lazy right now)

shane.carr
09-15-2006, 11:27 PM
:) Cool! Now the table is in the right place! :( Now the navigation list is out of place. How do I position that correctly?

shane.carr
09-18-2006, 05:40 PM
I will have to revert to using tables :( how do the "top" and "left" items work in CSS?

WebJoel
09-18-2006, 05:49 PM
I will have to revert to using tables :( how do the "top" and "left" items work in CSS?


style="position:relative; top:npx; left:npx;" whereby "n" is a whole number. Or you can use percentage, so instead of "npx", you'd use "20%", "30%", -whatever. I'll have to load your posted code into my editor and see if the answer meets your request though...
(edited)
re: th nested inside of tr, -is this corect?
opps- correction! Yes, TH are nested in TR. My opps. :eek: