Stylesheets per browser

For discussion and questions related to CMS Specific templates and stylesheets (CSS), and themes. or layout issues. This is not a place for generic "I don't know CSS issues"
Post Reply
jcaudill
New Member
New Member
Posts: 6
Joined: Tue Dec 11, 2007 8:57 pm

Stylesheets per browser

Post by jcaudill »

A designer has given me a template, that has a conditional that loads a stylesheet for all browsers besides IE7, and then one for IE7. Is there any way to implement something like this within CMS MS? I need to at least get something into CMS MS so Tiny MCE can parse the styles.

Thanks,
JP
TJINAK
Forum Members
Forum Members
Posts: 136
Joined: Wed Feb 22, 2006 1:01 am

Re: Stylesheets per browser

Post by TJINAK »

Try this:

1. Create a a new page template.
2. Drop the smarty tag {stylesheets} from your new template.
3. Include your scripting that calls the appropriate stylesheet to your custome template, wrap it in the {literal} tags.  You may also look into creating a custom tag if its php thats calling the stylesheets. (Find it under the extensions menu, user defined tags) for more info see http://wiki.cmsmadesimple.org/index.php ... fined_Tags

TJ
jcaudill
New Member
New Member
Posts: 6
Joined: Tue Dec 11, 2007 8:57 pm

Re: Stylesheets per browser

Post by jcaudill »

Ya I've done that and it works fine, however, if the stylesheet is not loaded into CMS MS, then the different style classes aren't available to Tiny MCE. Should I load the stylesheet in, link it to the template but just not use the {stylesheet} tag?

JP
User avatar
kermit
Power Poster
Power Poster
Posts: 693
Joined: Thu Jan 26, 2006 11:46 am

Re: Stylesheets per browser

Post by kermit »

it sounds like your designer styled the entire layout twice; once for "other browsers" and again for ie7 only... which can mean double-the-work if you want to make even a simple change like a text color...

but the more common (and usually much easier) way is to have ONE stylesheet for ALL browsers, and if necessary, use an ie-specific conditional to load CHANGES ONLY for a particular version of ie. usually there aren't many "fixes" needed for ie; and if that's the case, you may even be able to use just *one* stylesheet for everybody and target a specific version of ie with css filters (exploting quirks, which aren't always 'bugs', in the way browsers parse stylesheets), and there are a couple methods for doing just that with ie7.
Last edited by kermit on Fri Dec 14, 2007 1:14 pm, edited 1 time in total.
eternity (n); 1. infinite time, 2. a seemingly long or endless time, 3. the length of time it takes a frozen pizza to cook when you're starving.
4,930,000,000 (n); 1. a very large number, 2. the approximate world population in 1986 when Microsoft Corp issued its IPO. 3. Microsoft's net profit (USD) for the quarter (3 months) ending 31 March 2007.
CMSMS migration and setup services | Hosting with CMSMS installed and ready to go | PM me for Info
ericob

Re: Stylesheets per browser

Post by ericob »

jcaudill wrote: Ya I've done that and it works fine, however, if the stylesheet is not loaded into CMS MS, then the different style classes aren't available to Tiny MCE. Should I load the stylesheet in, link it to the template but just not use the {stylesheet} tag?

JP
I'm just a relative beginner with these Internet Explorer conditional comments, but it seems the usual way to implement this is that you have identical class names, but they are defined differently in the "For IE" stylesheet than in the "For all other browsers" stylesheet.

This way, the markup in the pages you deliver doesn't need to change.  For example, you do not have styles named "Sidbar_IE" and "Sidebar," you have only one "Sidebar."

A conditional comment on every page will cause IE to use the stylesheet designed for it.
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: Stylesheets per browser

Post by Dr.CSS »

Most times you will only need conditional CSS calls for IE6 or 7 for the same thing as Firefox as in you may need to have less margin in the IE6 call because it has a problem with the box model not because you want something to show up blue in IE and green in all other browsers so it won't be an IE CSS call that will be used in the style drop down in the editor...

For IE6 you can use the star hack... * html #nameofdiv {your IE style} just below the normal call, or google for IE6 & 7 hacks
Post Reply

Return to “Layout and Design (CSS & HTML)”