I’m going to start my first Yii application and would like to modify the CSSs files but can’t find anything that explains the CSS structure and how to manage them.
I took a look at the default application generated with yiic but I can’t understand how its CSSs work.
I’d be interested to hear that as well as I noticed the same lack of info about “working with CSS in Yii”.
I think that in a nutshell:
CSS files that belong to either specific view or layout should be included and referenced from within that layout. See main.php layout generated by yiic for the generic app it creates.
More specific CSS inclusion can be triggered by calling some methods in classes which I don’t remember by heart (nor did I try this yet).
The most important thing to know about the CSS structure, as seen in the yiic generated web application, is that it uses the BluePrint CSS framework.
It’s a grid based CSS framework, which makes it much, much quicker to generate wholesome layouts.
BluePrint home page
I personally like it a lot.
Some webdesigners view grid based layouts/frameworks as only a tool from which you create your own css from, but I find that it helps me (a non-designer) to create coherent looking sites.
I’ve read the blueprint tutorial and looks like it’s very simple, but can’t understand why in the default application generated by yiic the HTML code doesn’t have any “span-x” class or similar.
For example, there’s the “header” id without any specified blueprint classes but anyway it’s got its width that’s not specified anywhere.
Is it because blueprint make it using the default size so there’s no need to specify it?
I’m not a CSS expert but I think that inline styling should be avoided in any case. Do it all in CSS. just use divs classes. This way, separate styling from layout altogether. I think this is a good general recommendation regardless of BluePrint.