Support Forum

Please note that this forum is only available to you in read only mode. In order to contribute to this conversation you will need to renew your subscription.

How to link a IE specific CSS file

zentoolsIf you use Zentools please post a review at the Joomla! Extensions Directory.

I need a bunch of specific css code in order to display some features ( with PIE.htc ) in IE8.

What is best practice?

I would like to separate those definitions in a separate ie8.css file.
But where an how do I call that file?

Nicest solution would be from custom.css.

I would rather not put link into tpls/blocks./head.php as that would be intrusive and would have some concern for 'updates'.
  • Tom's Avatar
  • Tom
  • LIfetime Developer - Big Bamboo
  • 132 posts
  • Karma: 1
The administrator has disabled public write access.
Best way I think would be use the
before </head>
in the injection tab

In there add your conditional together with the code (thanks Rob:)

Cheers
Paul
  • manh's Avatar
  • manh
  • Moderator
  • 45248 posts
  • 2106 Thanks
  • Karma: 603
The administrator has disabled public write access.
Hi Tom,

It dpeends on how many things you need to add but you will definitely need to add a link to the htc file. That can be done int he template admin and wont be lost on update.

For a few one off css hacks perhaps try this page:
www.paulirish.com/2009/browser-specific-css-hacks/

You could easily add them to the custom.css file.

Thanks
  • Anthony Olsen's Avatar
  • Anthony Olsen
  • LIfetime Developer - Big Bamboo
  • 23925 posts
  • 788 Thanks
  • Karma: 433
The administrator has disabled public write access.
The solution with the injection before </head> seems the most logical to me.

However when I try that it does not seem to work.
If i put the same code in tpls/blocks/head.p right after where custom.css is included it does work.

My code:
<!--[if lt IE 9]>
<link href="<?php echo T3_TEMPLATE_URL ?>/css/ie.css" rel="stylesheet" />
<![endif]-->
  • Tom's Avatar
  • Tom
  • LIfetime Developer - Big Bamboo
  • 132 posts
  • Karma: 1
Last Edit: 6 years 4 months ago by Tom. Reason: Changed filename
The administrator has disabled public write access.
It seems code from Injection is not being 'picked' up.

In the code I removed the condition for LT IE9 so only the stylesheet should be included on every browser. However when inspecting with FireBugonly reference to custom.css is shown, no reference to ie.css.

What am I missing?
  • Tom's Avatar
  • Tom
  • LIfetime Developer - Big Bamboo
  • 132 posts
  • Karma: 1
Last Edit: 6 years 4 months ago by Tom. Reason: Typo's
The administrator has disabled public write access.
Hmm yes I see that.

In the general tab in the template admin can you add the code in the addcode parameter?

Thanks
  • Anthony Olsen's Avatar
  • Anthony Olsen
  • LIfetime Developer - Big Bamboo
  • 23925 posts
  • 788 Thanks
  • Karma: 433
The administrator has disabled public write access.
Nope, seems to te be used.

I also tried removing the IE condition. No effect there.

( I just tried to change background color. )

I even tried to remove all code from custom.css to see if that was causing a conflict.
But my code does not seems te be executed / loaded.
<link href="<?php echo T3_TEMPLATE_URL ?>/css/ie.css" rel="stylesheet" />

But when put into tpls/blocks/head.php it wil work.

----

Ok I found the problem:

When I put in the path hardcoded it will work. So it seems the PHP code can not be executed.
<link href="/templates/<templatename>/css/ie.css" rel="stylesheet" />

I tried both addcode parameter but also the Injection before </head>.
Both seems to work.
  • Tom's Avatar
  • Tom
  • LIfetime Developer - Big Bamboo
  • 132 posts
  • Karma: 1
The administrator has disabled public write access.
Right thanks a lot for posting back with your solution +1

Cheers
Paul
  • manh's Avatar
  • manh
  • Moderator
  • 45248 posts
  • 2106 Thanks
  • Karma: 603
The administrator has disabled public write access.
Paul, no problem.

Perhaps it wise to put in in the documentation :P

Maybe Anthony could tell if my solution is what was intended, because his reaction led me to think otherwise.
  • Tom's Avatar
  • Tom
  • LIfetime Developer - Big Bamboo
  • 132 posts
  • Karma: 1
The administrator has disabled public write access.

zentoolsIf you use Zentools please post a review at the Joomla! Extensions Directory.

Happy Campers