This is a discussion on "[SOLVED] How do I write IE conditional comment" within the Web Page Design section. This forum, and the thread "[SOLVED] How do I write IE conditional comment are both part of the Design Your Website category.
|
|
|
|
|
![]() |
||
[SOLVED] How do I write IE conditional comment
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
#1
|
|||
|
|||
|
[SOLVED] How do I write IE conditional comment
I have a site I'm working on temporarily located here http://geocities.com/lchadwind/
It looks fine in IE7 and FF2 but the .menu classes are too wide for IE6. So my third div floats down underneath the first two. Since I've been playing around with the margins and padding and widths and not come up with anything that will work as a compromise across the browsers, I've decided to use a Conditional Comment. Can someone tell me how it's done? I've looked at several tutorials and am completely confused. None of the tutorials worked. I'm sure I did them wrong but hey.. I tried... |
|
|
|
#2
|
||||
|
||||
|
Re: How do I write IE conditional comment
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
|
|
#3
|
||||
|
||||
|
Re: How do I write IE conditional comment
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
|
|
#4
|
|||
|
|||
|
Re: How do I write IE conditional comment
Beautiful Alex .. thank you...
I had tried your example but did not have this Quote:
Is that where I went wrong? I did find another solution but I'm not sure it's as good as the one Alex gave.
|
|
#5
|
|||
|
|||
|
Re: How do I write IE conditional comment
Don't worry; it's really easy once you get used to it, and it's extremely useful.
First, let's look at an ordinary HTML comment:
IE, however, looks slightly deeper, because it's watching out for conditional comments (CC's):
CC's are great for serving an extra stylesheet to IE. For example:
So you can use IE.css to override the existing styles. Let's say style.css has p { color: blue }, and IE.css has p {color: red }. Then IE will get red paragraphs, while all other browsers get blue paragraphs. You can also use CC's to isolate different versions of IE:
|
|
#6
|
||||
|
||||
|
Re: How do I write IE conditional comment
I don't think the other will validate, without the use of "!important;".
And yes I think the style tag with not attributes was where you went wrong
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
|
|
#7
|
||||
|
||||
|
Re: How do I write IE conditional comment
What?? What needs the '!important'.. Please explain - i seem to have lost you!
__________________
Marc Staff Manager - Webforumz.com Want to be a moderator? PM me. |
|
#8
|
||||
|
||||
|
Re: How do I write IE conditional comment
Quote:
This means, that "this property is not important, if another script tells it to be something else, let it." Practical example:
This would mean that in IE7 the boat class would be blue.
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
|
|
#9
|
||||
|
||||
|
Re: How do I write IE conditional comment
Would it :s That looks like to me they would both be red. Mabey i need to get off this computer! Im fighting shadows!
__________________
Marc Staff Manager - Webforumz.com Want to be a moderator? PM me. |
|
#10
|
||||
|
||||
|
Re: How do I write IE conditional comment
It is using some programming techniques known as inheritance and overriding.
Because the boat's red property is not important, the IE7 conditional comment overrides the existing one. Do you follow?
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
|
|
#11
|
|||
|
|||
|
Re: How do I write IE conditional comment
Quote:
You need to understand the rules about CSS conflicts before you start fire-bombing your code with !important everywhere.
Quote:
!important is extremely useful for debugging CSS conflicts, but you must remove it after debugging -- or else your debugging process will be compromised next time. I have never found a need for !important, except for in debugging. Indiscriminate use of !important is sloppy CSS, and it will come back to haunt you one day -- when you run out of overrides, and realise you need to learn about specificity. Last edited by MikeHopley; Oct 10th, 2007 at 21:54. |
|
#12
|
||||
|
||||
|
Re: How do I write IE conditional comment
i'll shutup then
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
|
|
#13
|
|||
|
|||
|
Re: How do I write IE conditional comment
No Alex.. you don't need to shut up!
You answered my question perfectly. 99 out of 100 times I use external style sheets but this ONE time, I have to put the css inline because this is a shopping cart homepage. No ability to externally attach a stylesheet. Well maybe there is but I don't want to figure it out.. Mike.. you should be a teacher! (Maybe you are?) Excellent explanation. I will stick this in my subscriptions. Thanks a million! |
|
#14
|
|||
|
|||
|
Re: How do I write IE conditional comment
No, don't do that! You gave exactly the right answer for Linda's problem.
And if you had kept quiet about !important, you would still be unaware how it really works. Quote:
|
|
#15
|
||||
|
||||
|
Re: How do I write IE conditional comment
Okay, I'll keep blabbering
And a "mentor" is a teacher anyway, so you are ha.
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
|
|
#16
|
|||
|
|||
|
Re: How do I write IE conditional comment
I appears that everything above is not working.
I have added this to between the <head></head>
I have it set for ff at the moment but the IE7 and IE6 are not following their if's. |
|
#17
|