Connecting Tech Pros Worldwide Forums | Help | Site Map

CSS Large project logic

Member
 
Join Date: Jan 2008
Posts: 116
#1: Jul 7 '08
I've been thrown into the world of web development and have neared completion on my first project. One thing I quickly discovered was the necessity of CSS to keep things consistent. Currently, I have all the my style classes in one file (styles.css) As I go back to tweak/make changes I find the file to be too cumbersome to read quickly. I would like to separate the CSS classes into different files for easy locating and easy reading; However, I would like to leave all my html files to only include the one "styles.css" file so when I make new pages I dont have to make sure I include every style sheet. So far I dont think thats possible..

So, my questions..What is the best way to handle CSS in large projects? Can there be any kind of inheritance of CSS files from one to the other?

hsriat's Avatar
Expert
 
Join Date: Jan 2008
Location: Bath, UK
Posts: 1,609
#2: Jul 7 '08

re: CSS Large project logic


I ran into a somewhat similar situation, and I discovered a solution myself. Though I'm not sure if this is a good solution.
But what I did was, I created a PHP file with declared constants on the top. These constants contains constants like 'COLOR1', 'COLOR2', 'FONTS1' etcetera, so that changing one constant could change the look of entire web in a regular way.

The PHP file sends different style information depending upon the GET parameters.
Reply