|
| |
|
|
pcguy
Posts: 137 From: None Status: offline
|
How do I do this? Or can't I? - 2/27/2009 16:11:27
First, let me say - be gentle - I am starting to use CSS for my layouts, instead of tables. That said, See the attached file. You will see 4 DIVS, all labeled with ID# tags.... My layout, as it currently is, looks like the attachment, WITHOUT the #extraContent DIV. (with red arrow).... So I have the mainContent div, the left and right columns....you can see the left column has a height, which is set in pixels. The right Div does not, and stretches to accomodate the content in the div. My question is, how would I add the #extraContent div to this layout? I want to add it just as it appears in the JPG. (I'm looking for how/where the DIV tag would go, and if I'd use a float, ect).... Thanks!
Attachment (1)
|
|
|
|
Giomanach
Posts: 6187 Joined: 11/19/2003 From: England Status: offline
|
RE: How do I do this? Or can't I? - 2/27/2009 20:52:47
To achieve that kind of layout, you would only need to float the #rightColumn div. Here's why and how You want your main content on the right (or at least that's what I'm guessing) and two divs on the left for navigation and other items. Now, the easiest way to do this is.... Order your divs like so:
<div id="contentContainer">
<div id="leftColumn">
Left Column Content In Here
</div>
<div id="extraContent">
eXtra Content in here
</div>
<div id="rightColumn">
RightColumn Content In Here
</div>
</div>
Note: this isn't really good for SEO, but allows for easiest coding, and less design flaws across browsers. If you want it to be more SEO friendly, the CSS gets a bit more complicated, so I'll stick to this for now. Now, your CSS for the placement etc, will be as follows:
#contentContainer{
margin: 0 auto; /* Centers the whole div on the page if you use text-align: center; on body or html */
width: 800px; /* Width of the main content - change to a % for a fluid design (85-90% is a common favourite) */
}
#leftColumn{
width: 150px; /* Adjust to suit your design */
}
#extraContent{
width: 150px; /* Adjust to suit again, but keep same width as leftColumn */
}
#rightColumn{
float: left; /* Makes the Div ignore all placement above it on the screen */
position: relative; /* Keeps the Div in place at the top of the parent div (contentContainer) */
width: 100%; /* 100% width to keep it so you can still see all content within the div */
margin-left: 160px; /* Change to suit design. If a fluid design, ensure its a few % MORE than the width of the two divs on the left, else make it 5-10px bigger than them */
}
Read the comments I've put in on how to alter it to suit. That *should* in essence give you the desired layout, but be warned, it's not an SOE friendly way of coding it, but it is by far the easiest. Gio
_____________________________
|
|
|
|
pcguy
Posts: 137 From: None Status: offline
|
RE: How do I do this? Or can't I? - 2/28/2009 7:15:22
Awesome info! thank you so much for posting... I would have guessed to float the rightColumn with "right" float....I should try to see what happens... Why is this bad for SEO? Again, many thanks!
|
|
|
|
Giomanach
Posts: 6187 Joined: 11/19/2003 From: England Status: offline
|
RE: How do I do this? Or can't I? - 3/1/2009 18:52:55
It's not really bad for SEo - it's just not all that friendly SEO friendly coding has all the coding at the start of the <body> of the HTML document rather than the end - it's just easier to code with it in the order you want it to sit on the page. I've coded like this for years and never had any problems with it at all.
_____________________________
|
|
|
|
pcguy
Posts: 137 From: None Status: offline
|
RE: How do I do this? Or can't I? - 3/4/2009 14:59:20
Gio - I finally got a chance to try this....I used your code, however, if I use it "as-is", the rightColumn displays below both the other DIVS.... If I insert the entire rightColumn DIV tag right before the closing LeftColumn DIV tag, it works, kinda...
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|