Web Hosting Talk







View Full Version : CSS Conditionals


rej1587
06-03-2006, 10:23 AM
Well I was having some css issues with my site mainly because IE would throw everything off so I created a seperate stylesheet and used an IF IE conditional. I was just wondering how reliable they are?

Can see it in action at http://www.linkr.us

the_pm
06-03-2006, 10:51 AM
If you have created them properly, they are 100% reliable. IE is specially trained to recognize them, and al other browsers will only see them as comments. This is a perfectly safe method.

layer0
06-03-2006, 11:02 AM
If you have created them properly, they are 100% reliable. IE is specially trained to recognize them, and al other browsers will only see them as comments. This is a perfectly safe method.
I concur. I use the if IE conditional all the time, works flawlessly.

It's much better than using CSS 'hacks' to fix the issues, too.

Cheers,

rej1587
06-03-2006, 11:27 AM
Awesome, many thanks :).

JBelthoff
06-03-2006, 01:30 PM
I would suggest before using a conditional that you are sure that you can't fix it another way.

No reason to do seperate coding if it can be done without it...

Just my 2 cents anyway...

:peace:

Fixago
06-03-2006, 02:42 PM
I agree. I used to use incrementals a lot, where you utilized the formatting of the HTML tag because only IE recognized it, but now I stay away from using any type of "hack" out there. I've never had to put in hacks or conditionals now, too sloppy in my opinion. You can design a site without resorting to this, sometimes if you're doing really advanced things you can't, but most of the time there's just no need. There's always a way around it.

I'm not sure I see what about your site you couldn't accomplish without going that route?

rej1587
06-03-2006, 04:48 PM
~Fixago, I'm sure it could have been accomplished if it weren't for my lack of skills. I was mainly having issues with font sizes and IE having a mind of its own when it came to how big the div actually was.

Links would look perfect in FF or Safari, but then I'd be told that they were absolutely huge on IE.

Fixago
06-04-2006, 12:19 AM
Do you use em or px settings for your fonts? I always set a base font size for the body of 62.5% and then I specify the paragraph, headings, etc. as em sizes. Why 62.5%, well for some reason Opera doesn't like certain percentages, and that's just one I like to use.

Always go with a base font for the body and then change things with the em unit. I stopped using pixels and points a long time ago.

NyteOwl
06-04-2006, 04:03 PM
I set a base size as well and use em's thereafter. But unlike Fixago I set the base font size in pixels. I find setting a relative size (em's) based on another relative size (%'s) to be far to variable. While the % is ultimately based on the fixed size the user has for default browser text I did run across one person whose default text size was (for whatever reason) set to 9 px. Now to use 62.5% as a base and then apply .8em to that . . . :)

Fixago
06-05-2006, 03:25 AM
Interesting point, I never thought about that actually. As a rule of thumb, with the em unit, I never go below 1em. I set a base font-size of 62.5% and then set my paragraphs to 1em and then headings of course higher than that, with 1em obviously being the font-size I want the "default" font to be.

When you set a base font in pixels, do you find that people in IE can still increase/decrease the font-size? Because I noticed that if I set all my font-sizes to pixels (which is the reason I stopped using that unit) that people in IE couldn't increase/decrease the font-size. This doesn't work the same in, say, Firefox, you can set the unit to pixels and users can still increase/decrease the font size.

I actually like how IE won't let you increase the font-size when you set it to pixels, because there's some things that I do put in pixel amounts for that very reason.

the_pm
06-05-2006, 04:19 PM
I actually like how IE won't let you increase the font-size when you set it to pixels, because there's some things that I do put in pixel amounts for that very reason.It's not uncommon for the designer to enjoy and even actively exploit this browser bug. But in the end, it is horrible for the end user, and it really is the responsibility of the designer to design with the best intentions of the end user in mind. This might be challenging at times, and it might take some creative engineering to make layouts that adapt gracefully to the font size needs of the end user, but to inhibit someone from making changes to font size that are necessary for them to be able to surf a site is just...mean.