I love neat code - I always try and reduce the amount of code written to as little as possible whilst retaining legibility.
What I have found when outsourcing CSS is that it will come back it will display perfectly but there will be 1000 lines of CSS with hundreds of classes. This led me to believe there must be a better way of doing this.
I am not saying I am the first to do this I am sure its documented well, but I want to know what you think and send me any links which discusses this further
In my styles I set some OO classes such as:
Then in my front end I normally create a singular container for each large section to the site;
Then within my container without creating further classes I simply use the OO classes above:
Like I said, I know I won't be the first person to have done this, but why do I not see more websites done like this? Do people find it unreadable?
I managed to get my CSS document down to 127 lines. This obviously means the speed at which the page loads is faster due to reduced css size, and also I find it much easier to maintain/read.
What are your thoughts?
What I have found when outsourcing CSS is that it will come back it will display perfectly but there will be 1000 lines of CSS with hundreds of classes. This led me to believe there must be a better way of doing this.
I am not saying I am the first to do this I am sure its documented well, but I want to know what you think and send me any links which discusses this further
In my styles I set some OO classes such as:
PHP:
.size14 {font-size:14px;}
.size11 {font-size: 11px;}
.grey {color:#606060;}
.bold {font-weight: bold;}
.left {float: left;}
.right {float: right;}
.clear {clear:both;}
.inline-block {display: inline-block; *display:inline;}
.thirds {width: 320px;}
.width-635 {width: 635px;}
.width-210 {width: 210px;}
.margin-top-10 {margin-top:10px;}
.margin-bottom-10 {margin-bottom:10px;}
.margin-right-15 {margin-right:15px;}
.padding-bottom-5 {padding-bottom: 5px;}
.no-padding-margin {padding: 0; margin:0;}
.text-right {text-align: right;}
.text-left {text-align: left;}
.text-center {text-align: center;}
Then in my front end I normally create a singular container for each large section to the site;
PHP:
<div class="container"></div>
Then within my container without creating further classes I simply use the OO classes above:
PHP:
<div class="container">
<div class="left thirds">
<span class="size14 inline-block"> some text here</div>
</div>
<div class="right thirds">
etc
</div>
</div>
Like I said, I know I won't be the first person to have done this, but why do I not see more websites done like this? Do people find it unreadable?
I managed to get my CSS document down to 127 lines. This obviously means the speed at which the page loads is faster due to reduced css size, and also I find it much easier to maintain/read.
What are your thoughts?