Conditional Comments

Do something cool with CMS? Show us ...
This board is for 'Answers', and the discussion of answers... Not for questions.
Post Reply
SideshowBob
Forum Members
Forum Members
Posts: 80
Joined: Thu Sep 13, 2007 10:50 am

Conditional Comments

Post by SideshowBob »

Do you need to target specific IE browsers using conditional comments?

Here's an example for Internet Explorer 6 but you could use the same technique for other conditional comments.

Create a stylesheet called IE6 but don't link it to any templates. Then put in all those little tweaks that you want, now insert the below code just above the closing head tag into your template(s):

Code: Select all

<!--[if IE 6]>
    {stylesheet name='IE6'}
<![endif]-->
And that's it.

Bob
User avatar
duclet
Forum Members
Forum Members
Posts: 187
Joined: Fri Jun 23, 2006 12:55 pm

Re: Conditional Comments

Post by duclet »

No need for this. Use this instead is better since it allows you to target more than just IE.

http://forum.cmsmadesimple.org/index.ph ... 827.0.html
JeremyBASS

Re: Conditional Comments

Post by JeremyBASS »

@SideshowBob
you may want to read this ... mostly the part about "IE6 and other" conditional commenting...
IE 7 IE 8 FF
http://blog.corbensproducts.com/Blogs/3 ... ments.html

hope this helps ;)
jeremyBass

PS this is not a CMSMS tip or trick  ;D
Last edited by JeremyBASS on Fri Apr 10, 2009 2:34 pm, edited 1 time in total.
SideshowBob
Forum Members
Forum Members
Posts: 80
Joined: Thu Sep 13, 2007 10:50 am

Re: Conditional Comments

Post by SideshowBob »

Thanks Duclet, I actually used your method originally (which is really cool) but some of the css I used caused my page not to validate hence the move to conditional comments.

Jeremy: Thanks for the link, I am aware of the more advanced stuff you can do with conditional comments but that's a good summary.

I'm sorry if you didn't like my tip (or even consider it a tip), I searched the forum and found others asking about conditional comments and I didn't see my solution presented, hence the post.

Bob
JeremyBASS

Re: Conditional Comments

Post by JeremyBASS »

Oh I don't think it's a bad tip.. I was just saying it's not a CMSMS trick per-say... and What I was meaning by
IE 7 IE 8 FF
is that targets for not IE6 but includes none IE browsers.... I said that as I normal use both when I filter... but it's not commonly known... just My2Cents :)

cheers
jeremyBass
User avatar
duclet
Forum Members
Forum Members
Posts: 187
Joined: Fri Jun 23, 2006 12:55 pm

Re: Conditional Comments

Post by duclet »

What didn't validate?
SideshowBob
Forum Members
Forum Members
Posts: 80
Joined: Thu Sep 13, 2007 10:50 am

Re: Conditional Comments

Post by SideshowBob »

I'm using background-position-y to help beat IE6 into submission. There's probably another way to do if I could have been bothered to look a little more.

I quite like the idea of conditional comments as they avoid loading extra css that are only needed as IE fixes.

Bob
smirkingdude
Forum Members
Forum Members
Posts: 17
Joined: Fri Sep 21, 2007 7:31 pm

Re: Conditional Comments

Post by smirkingdude »

I like IE conditional comment...useful when one module (for example: Album module) has an option that links to one CSS file (/modules/Album/css/stylesheet.css) and you want to use a seperate CSS file to focus on IE browser.

Look here...http://forum.cmsmadesimple.org/index.php/topic,32675.0.html  :)
Last edited by smirkingdude on Sat Apr 04, 2009 3:13 am, edited 1 time in total.
Post Reply

Return to “Tips and Tricks”