GetSimple Support Forum

Full Version: CSS Stycling technique
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I was just curious how the rest of you do your Cascades. For example. Do any of you just do your styling straight in to the page creation form using style tags.

Ive found that if I am using style rules that only apply to a specific page and are never seen again on the site that its pointless to hard code the rules in to the CSS file so I just use the style tags and write all my markup directly in to the page.

The only rules I hard code are specific to throughout the template or if i intend on using the template on different CMS's

I havent done much research on it but it works brilliantly but I never considered if it was a "proper" technique. As a professional designer of 13+ years I have learned that if the technique works it is a proper technique but I was just wondering how some of the rest of you do your page specific markup?
You typically never put styles inline aside form one offs.
Plus styles are a pain in the ass in most editors, they like to reformat stuff how they please.

It takes 5 seconds to add a class, in fact it should be second nature to add ids and classes to all elements you write , then you just style it later on all at once.

Or build up your own collection of styles you can use if you use them alot but do not want to really style your site.


for example grid systems you can do quick stuff like.

learn specificity and you can do alot of stuff easier and smarter.
need to target a specific page and change a few things then override the defaults using specificity.

h2 { font-size:20px }
#pagename h2 {font-size:30px } /* this works because we put the page slug as id in the body tag */

Or alternative heading colors.
h2 {color:blue }
h2.alt1 { color:red } /* h2 with a class of alt1 */

use multiple classes

<h2 class="title bold italic">heading 2</h2>
I typically do hardcode my CSS into the sheet its self but ive always had a thing about big CSS files and when I write them I do my best to keep them as light as possible.

My site im working on now is my main and it is visually based off of one of the themes here called mycompany, I mostly just liked the style but I did away with every line of its css and images and just built my own images and CSS just because I didnt want to scrape off somebody elses work.

I am glad you mentioned the body slug, that is one part of the template I forgot completely about when I wrote out the code so had to go back and add that in
(2012-12-14, 05:43:27)shawn_a Wrote: [ rel="nofollow" -> ]
h2 { font-size:20px }
#pagename h2 {font-size:30px } /* this works because we put the page slug as id in the body tag */

Aha - Clever! I had seen that <body id="<?php get_page_slug(); ?>" > but never knew it's use. Handy!
Yeah that body slug makes things incredibly convenient. I created separate templates for each of my areas simple because I completely forgot about that slug and didnt even include it in my template. Think the separate templates will still be needed because they all carry different sidebar variations so not a loss but will certainly make page styling alot less of a thought process. Wish id have remembered that two weeks ago though.