I want to create a clean CSS coding where classes are created for specific attributes, e.g. ".20mleft" class for a 20px margin-left to html elements applied. I want a div to have a 620px width and the other div having 220px width. Both divs are floated left and the 620px width div should have a 20px margin on its right. Both divs are contained inside a container class div. These are the codes.
HTML:
<div class="container">
<div class="8cols fleft 20mright" style="border:1px #333 solid;"><p>This is the Main Content</p></div>
<div class="3cols fleft" style="border:1px #333 solid;"><p>This is theSidebar</p></div>
</div>
I am using a 12 column 960 grid BTW.
CSS:
/** FLOAT OPTIONS **/
.fleft{float:left;}
/** BOX ELEMENTS **/
.container{width:940px; margin:0 auto;}
...
.3cols {width: 220px;}
...
.8cols {width: 620px;}
/** MARGIN OPTIONS **/
...
.20mright{margin-right:20px;}
Problem: The properties of .fleft class is the ONLY ONE working at all. The properties of the .8cols, .3cols and .20mright classes failed to apply. I checked Firefox's Inspector and I couldn't see the properties, except the.fleft class declaration. It seems like the divs' widths are controlled by the contents inside it.
For better explanation, download the picture below:
P.S. Ignore the header above. This is my project in case you are wondering.
Please help me ASAP. Thanks a lot.