473,395 Members | 1,689 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

conditional style rule

nathj
938 Expert 512MB
Hi,

I have a style sheet that works just fine with one small exception. The problem is that when the rule show below is applied by IE it only applies the background colour to the text not to the object it is within. Firefox does exactly what I want and IE will display correctly if I change the padding. This however, throws Firefox out.

CSS
Expand|Select|Wrap|Line Numbers
  1. .solidBlockMenu  p
  2.     {
  3.         float                : left;
  4.         padding                : 0px 11px;
  5.         margin                : 0px;
  6.         color                : #b36a1b;
  7.         background            : #eff5f3;
  8.         text-transform        : uppercase;
  9.         text-decoration        : none;            
  10.         font-weight            : bold;    
  11.         font-size            : 11px;
  12.         border-right        : 1px solid white;
  13.      }
  14.  
This code is used on a navigation bar so if the URL of the page matches the URL that was serverd from the database the item is not clickable - thus preventing the user from going where they already are. The background colour serves as a visual clue to this.

I want to be able to change the padding rule 2px 11px for IE only. Is there a way to do this without serving separate style sheets?
Jul 12 '07 #1
2 3065
nitinpatel1117
111 100+
You can serve an additional style sheet rather than a separate style sheet.
Only IE will read this additional style sheet.


Add this to the header of your html code, but below (this is important) the reference to the main style sheet


<!--[if IE]>
<link rel="stylesheet" href="styles-ie.css" type="text/css" />
<![endif]-->


the code in the addition style sheet (style-ie.css) would be just three lines.

.solidBlockMenu p {
padding: 2px 11px;
}


only IE will run the additional stylesheet.
and becuase this style sheet appears after the main one, it overrides the padding for 'solidBlockMenu p' in the main style sheet.
Jul 12 '07 #2
nathj
938 Expert 512MB
You can serve an additional style sheet rather than a separate style sheet.
Only IE will read this additional style sheet.


Add this to the header of your html code, but below (this is important) the reference to the main style sheet


<!--[if IE]>
<link rel="stylesheet" href="styles-ie.css" type="text/css" />
<![endif]-->


the code in the addition style sheet (style-ie.css) would be just three lines.

.solidBlockMenu p {
padding: 2px 11px;
}


only IE will run the additional stylesheet.
and becuase this style sheet appears after the main one, it overrides the padding for 'solidBlockMenu p' in the main style sheet.
Thanks for that. I have applied that and it works a treat.

Cheers
nathj
Jul 12 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

28
by: Benjamin Niemann | last post by:
Hello, I've been just investigating IE conditional comments - hiding things from non-IE/Win browsers is easy, but I wanted to know, if it's possible to hide code from IE/Win browsers. I found...
39
by: jamilur_rahman | last post by:
What is the BIG difference between checking the "if(expression)" in A and B ? I'm used to with style A, "if(0==a)", but my peer reviewer likes style B, how can I defend myself to stay with style A...
8
by: pamelafluente | last post by:
Hi guys, Is it possible to add "onload" (via Javascript) a new class to the <styleheader section? If yes, how would that be done ? <style type="text/css" media="screen"> .NewStyleClass{...
6
by: patrick j | last post by:
Hi I've been testing out the "Conditional Comment" for IE. This is because for my web-site I want to have two style sheets, one for IE 6 and one for other browsers. Thus I hope to have my...
3
by: Martijn | last post by:
Hi, I hope I am in the right place on preprocessor help, 'cause the GNU preprocessor documentation is somewhat minimal on this topic. Assume I have two #define'd constants: #define STRING1 ...
5
by: paulo | last post by:
Can anyone please tell me how the C language interprets the following code: #include <stdio.h> int main(void) { int a = 1; int b = 10; int x = 3;
10
by: pamelafluente | last post by:
Hi, this time I am trying to add a style on the fly.I wish equivalency with this one (only the menuItemStyle line): <head> <style type="text/css" media="screen"> ... some static styles ......
4
by: Zack | last post by:
Hi, Let's say you have this function named validate. validate looks like this: function validate() { return ($F("Email") != '' ? ($("Name").value = $F("Email")) : false); }
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.