Search Engine Optimization Forum - SEO Refugee  

Go Back   Search Engine Optimization Forum - SEO Refugee > Business and Commerce > Web Design and Coding

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-10-2009, 04:53 PM
pops's Avatar
Not a real SEO!
 
Join Date: Nov 2005
Location: St. Louis, MO (almost)
Posts: 3,513
pops SEOR Gurupops SEOR Gurupops SEOR Gurupops SEOR Gurupops SEOR Gurupops SEOR Gurupops SEOR Gurupops SEOR Gurupops SEOR Guru
pops SEOR Gurupops SEOR Gurupops SEOR Gurupops SEOR Gurupops SEOR Gurupops SEOR Gurupops SEOR Gurupops SEOR Gurupops SEOR Gurupops SEOR Gurupops SEOR Guru
Lightbulb CSS Puzzle: I have the answer, just don't know the question!

Take a look at this page in FireFox:

Note the position of both sidebars is affected by the top margin of the MainContent div. Even though they are outside of mainContent!
Code:
<body class="thrColFix">
<div id="container">
  <div id="sidebar1"></div>
  <div id="sidebar2"></div>
  <div id="mainContent"></div>
</div>
</body>
</html>
The solution is on this page. By placing a clearing element at the top of container, things work as they should.

Code:
<body class="thrColFix">
<div id="container">
  <br class="clearfloat" />
  <div id="sidebar1"></div>
  <div id="sidebar2"></div>
  <div id="mainContent"></div>
</div>
</body>
</html>
One last bit of weirdness, putting a border around container will fix the problem without using the clearing element.

The CSS for both is
Code:
@charset "UTF-8";
body  {
    background: #2F2C2D;
    margin: 0;
    padding: 0;
    text-align: center;
}
.thrColFix #container {
    width: 960px;
    margin: 0px auto;
    Position: relative;
} 
.thrColFix #sidebar1 {
    left: 0px;
    top: 25px;
    position: absolute;
    height: 330px;
    width: 330px;
    background: #CCC;
}
.thrColFix #sidebar2 {
    float: right;
    width: 180px;
    margin-top: 260px;
    height: 300px;
    background: #999;
}
.thrColFix #mainContent {
    margin: 90px 180px 0px 275px;
    background: #FFF;
    position: relative;
    height: 600px;
}
.clearfloat { 
    clear:both;
    height:0;
    font-size: 1px;
    line-height: 0px;
}
Am I missing something here or is this just your regular everyday CSS insanity.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 06-11-2009, 08:55 AM
chovy's Avatar
Registered member
 
Join Date: Dec 2008
Posts: 3
chovy is on probation LOLz
sounds like a compounding margin.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 06-11-2009, 11:23 AM
pops's Avatar
Not a real SEO!
 
Join Date: Nov 2005
Location: St. Louis, MO (almost)
Posts: 3,513
pops SEOR Gurupops SEOR Gurupops SEOR Gurupops SEOR Gurupops SEOR Gurupops SEOR Gurupops SEOR Gurupops SEOR Gurupops SEOR Guru
pops SEOR Gurupops SEOR Gurupops SEOR Gurupops SEOR Gurupops SEOR Gurupops SEOR Gurupops SEOR Gurupops SEOR Gurupops SEOR Gurupops SEOR Gurupops SEOR Guru
Quote:
Originally Posted by chovy View Post
sounds like a compounding margin.
Do you have a link to any more information on that?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 06-11-2009, 12:19 PM
chovy's Avatar
Registered member
 
Join Date: Dec 2008
Posts: 3
chovy is on probation LOLz
certain tags compound margins with their parents or siblings.

An example would be two paragraphs in a row, the compounding is necessary so the first paragraph doesn't have less margin than the following paragraph.

<p id="first">...</p>
<p id="second">...</p>

If you took the top margin off both of them, you would still see a margin inbetween first and second, because bottom margin of the first paragraph would still prevail...

A better example is to say that the top margin of a paragraph compounds with the bottom margin of its previous sibling paragraph.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 06-12-2009, 05:55 PM
pops's Avatar
Not a real SEO!
 
Join Date: Nov 2005
Location: St. Louis, MO (almost)
Posts: 3,513
pops SEOR Gurupops SEOR Gurupops SEOR Gurupops SEOR Gurupops SEOR Gurupops SEOR Gurupops SEOR Gurupops SEOR Gurupops SEOR Guru
pops SEOR Gurupops SEOR Gurupops SEOR Gurupops SEOR Gurupops SEOR Gurupops SEOR Gurupops SEOR Gurupops SEOR Gurupops SEOR Gurupops SEOR Gurupops SEOR Guru
sounds like your talking about something similar to what I've seen referred to as margin collapse. None of the examples I've seen fits my situation but the border is one solution and it worked here so maybe…
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

  Search Engine Optimization Forum - SEO Refugee > Business and Commerce > Web Design and Coding

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT -8. The time now is 03:47 AM. - Contact Us - SEOrefugee.com - a Search Engine Optimization Forum - Top

Powered by vBulletin®
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
SEO Refugee