Zeke2
10-20-2010, 09:30 PM
Hi. I know Im new here, but I was wondering if anyone had any advice for me. Im having alot of trouble getting the foundation for structuring a website together. If it helps, Im not here to get a quick answer and then jet off, I'm in this to learn and keep going. I am extremely new to codeing but am attempting to learn everything I can.
Ok so in theory, I create a containing Div tag, that everything goes into.
So lets say I want a centered banner, a nav on the left, a content section in the middle, and another nav on the right.
So, it's basically, a containing div around all of that to start with.
Now are there any special attributes I should be setting for this div? Ill start it at 800px wide
div.container {
width:800px;
margin-left:auto;
margin-right:auto;
position:relative;
background-color:#ffffff;
}The margin-left/right are there to center it. The relative position is to make it
relative to the previous element, being the <body>tag(?) so it centers on that?
(trying to understand this, so be gentle).
Ok so if that is correct.(im assuming the height comes into play when I input more
data.
Next I want the center banner.
So
div.banner {
width:600px;
height:20px;
left:100px;
background-color:#ffffff;
position:relative;
border:1px solid green;
}
Skipping the obvious, I want it centered; so I made it left 100px because the center
div tag is 800 px(800-600=200=100px on each side). Now is that the best/appriopriate
way of aligning an element?
Also, if I want some space between the top of the div.container and the banner, do I
use <br /> or top padding? (I am imagining <br />)
Im kinda screwed here, and it's really bugging me to be honest. I now want to create a nav on the left a content section in the middle and a nav on the right.
But how do I do this? :S Before I even get to the right side im screwed
div.leftnav {
width:100px;
position:relative;
border:1px solid red;
}
div.content {
position:relative;
vertical-align:top;
left:100px;
width:500px;
margin-left:50px;
border:1px solid red;
}It creates the content section below the leftnav. How do I create them to be top aligned :S.
I dont know, I feel like I am going about this all wrong to be honest lol. Any direct advice on my problem(s)?
Im not sure I understand the concept of relative positioning.
Ok so in theory, I create a containing Div tag, that everything goes into.
So lets say I want a centered banner, a nav on the left, a content section in the middle, and another nav on the right.
So, it's basically, a containing div around all of that to start with.
Now are there any special attributes I should be setting for this div? Ill start it at 800px wide
div.container {
width:800px;
margin-left:auto;
margin-right:auto;
position:relative;
background-color:#ffffff;
}The margin-left/right are there to center it. The relative position is to make it
relative to the previous element, being the <body>tag(?) so it centers on that?
(trying to understand this, so be gentle).
Ok so if that is correct.(im assuming the height comes into play when I input more
data.
Next I want the center banner.
So
div.banner {
width:600px;
height:20px;
left:100px;
background-color:#ffffff;
position:relative;
border:1px solid green;
}
Skipping the obvious, I want it centered; so I made it left 100px because the center
div tag is 800 px(800-600=200=100px on each side). Now is that the best/appriopriate
way of aligning an element?
Also, if I want some space between the top of the div.container and the banner, do I
use <br /> or top padding? (I am imagining <br />)
Im kinda screwed here, and it's really bugging me to be honest. I now want to create a nav on the left a content section in the middle and a nav on the right.
But how do I do this? :S Before I even get to the right side im screwed
div.leftnav {
width:100px;
position:relative;
border:1px solid red;
}
div.content {
position:relative;
vertical-align:top;
left:100px;
width:500px;
margin-left:50px;
border:1px solid red;
}It creates the content section below the leftnav. How do I create them to be top aligned :S.
I dont know, I feel like I am going about this all wrong to be honest lol. Any direct advice on my problem(s)?
Im not sure I understand the concept of relative positioning.