473,405 Members | 2,404 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,405 software developers and data experts.

List Item Background Colour in Internet Explorer

KeredDrahcir
426 256MB
I'm using a list as a menu and it works fine in Firefox, Google Chrome, Safari and Opera but there are wierd results in Internet Explorer.

There is one problem in IE 8 and IE 9 which I can live with but in IE 8 the selected menu item is supposed to be white and it appears white for about a second and then goes to blue.
Expand|Select|Wrap|Line Numbers
  1. <div style="width: 980px; height: 42px;">
  2. <div class="mainmenu">
  3. <ul>
  4.     <li style="background-color: #ffffff; color: #7dc5f1; font-size: 11pt; font-weight: bold; height: 31px; padding: 11px 17px 0 16px; text-decoration: none; -moz-border-radius: 8px 8px 0 0; -webkit-border-radius: 8px 8px 0 0; border-radius: 8px 8px 0 0; behavior: url(/path/border-radius.htc); float: left;"><a href="link">Menu</a></li>
  5.     <li style="clear: both;"><a href="link">Menu</a></li>
  6.     <li><a href="link">Menu</a></li>
  7.     <li><a href="link">Menu</a></li>
  8.     <li><a href="link">Menu</a></li>
  9.     <li><a href="link">Menu</a></li>
  10.     <li><a href="link">Menu</a></li>
  11.     <li><a href="link">Menu</a></li>
  12.     <li style="float: right;"><a href="link" style="padding: 11px 16px 0;">Menu</a></li>
  13. </ul>
  14. </div>
  15. </div>
Expand|Select|Wrap|Line Numbers
  1. .mainmenu{
  2.     background-color:#3ca9e7;
  3. }
  4. .mainmenu li{
  5.     background-color:#3ca9e7;
  6. }
  7. .mainmenu li a{
  8.     color:#ffffff;
  9. }
  10. .mainmenu li:hover{
  11.     background-color: #3ca9e7;
  12. }
Does anyone know why this is?
Sep 14 '12 #1
9 3645
KeredDrahcir
426 256MB
Can anyone help? I am completely at a loss of what is causing this and I'm finding it's occuring more often. I seems to make no sense.
Oct 1 '12 #2
Rabbit
12,516 Expert Mod 8TB
Did you specify a doctype?
Oct 1 '12 #3
KeredDrahcir
426 256MB
Yes. I always specify it as XHTML.
Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Oct 3 '12 #4
probably because the background-color:#3ca9e7; within your external css style sheet is a blue colour if you wanted it to be white then background colour in your css should be white. have you tried changing the colour within the external style sheet also can i ask why you have use inline css to style your <li> tag ??
Oct 3 '12 #5
Rabbit
12,516 Expert Mod 8TB
Yeah, the code works fine for me on IE8. I just changed the hover color so that it's not the same as the background.
Oct 3 '12 #6
KeredDrahcir
426 256MB
I thought that inline styles overwrite the style sheet which was part of the reason I was using them.
Oct 11 '12 #7
Rabbit
12,516 Expert Mod 8TB
It does. But you only applied the inline style to that first li element. Not all of them.
Oct 11 '12 #8
KeredDrahcir
426 256MB
That's becuase the first li element is the one that is selected. I've got it applied to second one on the second page, the third one on the third page and so on.
Nov 2 '12 #9
Rabbit
12,516 Expert Mod 8TB
Yes, but that's exactly what I'm saying. Your inline style will only override that one element. That's why I had to change the hover color so it's not the same as the background to see that the code works fine.
Nov 2 '12 #10

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

Similar topics

1
by: John D | last post by:
I am trying to change the background colour of either a div or a textarea with javascript, but am having problems. I have passed a hex colour value in the variable hval, and with the following...
6
by: Louise | last post by:
Hi I have written an HTML pages which does not have any colour specifying tags as far I know. When I view this in an Microsoft internet explorer browser it appears with a white background and...
2
by: Tim Stevens | last post by:
Hello, This is the first time I have had to resort to posting on here, as Ive always been able to find a solution to my problems in the past by browsing postings by others. So, to start with I...
3
by: Maik Porkert | last post by:
Hi, i want to drop links I collected in an listbox to an InternetExplorer instance. I use currently the following code: private void listBox1_MouseDown(object sender,...
14
by: John Doe | last post by:
Hi Is it possible to set the background colour of a grid based on a value in data? I guess that it is simple but I have been unable to figure it out. TIA
0
by: energyonboard | last post by:
Hello all, Im a student doing a project with "Windows Explorer" and "internet Explorer" I would like to a. Get the current sort type (name/size/type/date modified - ascending/descending) b....
1
by: finewebsites | last post by:
In the code below, if you mouseover the word 'here', the border and image disappear. What is causing this to happen? (I'm running MSIE 6 on Windows XP.) (For the image, get '077988alpha_cat.gif',...
2
by: slaterino | last post by:
Hello, I'm hoping someone can help me with a couple of queries. I am in the process of designing a site which I have uploaded to: http://www.cca-ltd.co.uk/New/index.html, but I currently have 2...
1
by: avpkills2002 | last post by:
I seem to be getting this weird problem in Internet explorer. I have written a code for parsing a XML file and displaying the output. The code works perfectly fine with ffx(Firefox).However is not...
2
by: swethak | last post by:
Hi, I am getting the problem the problem with google map in Internet Explorer. This map worked fine in mozilla . When i opened the same map in Internet Explorer i am getting the error...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.