Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

list-style-image not working in Mozilla Firefox - any ideas?

Posted on 2004-11-22
12
Medium Priority
?
724 Views
Last Modified: 2007-12-19
Hello everyone again!

I have this code in my CSS

ul#mainnav ul.subnav li a:hover {
      color:#167B9F;
      list-style-image: url(images/content_nav_bullet.jpg);


      }



Upon rollover of the text in Subnav, it should show a custom bullet to the left.
It works fine in IE6 but not in Mozilla Firefox.

Any ideas please?
0
Comment
Question by:tingleweb
  • 5
  • 4
  • 2
  • +1
12 Comments
 
LVL 5

Expert Comment

by:php-webdesign
ID: 12642831
you can try:

ul#mainnav, ul.subnav, li a:hover {
     color:#167B9F;
     list-style-image: url(images/content_nav_bullet.jpg);
}

and does the color change or not??
0
 

Author Comment

by:tingleweb
ID: 12643268
The code in the CSS is actually as follows (yes, the colour changes if I change the hover colour in CSS):

      ul#mainnav {
      margin: 0px;
      padding: 0px;
      color:#167B9F;
      list-style: none;

      }
            
ul#mainnav li {
      display: block;
      border-top: 1px solid #FFFFFF;
      color:#167B9F;

      }

ul#mainnav li a {
      display: block;
      margin: 0px 0px 0px 0px;
      text-decoration: none;
      width: 88%;
      color:#167B9F;

      }


      
ul#mainnav ul.subnav {
      margin: 0px 0px 0px 10px;
      padding: 0px;
      color:#167B9F;
      list-style: none;

      
      }

ul#mainnav ul.subnav li {
      border-top: 0 none;
      color:#167B9F;
      font-weight: bold;
      line-height: 210%;
      font-size: 0.995em;
      }

ul#mainnav ul.subnav li a {
      margin: 0px;
      color:#167B9F;
      
      }

ul#mainnav, ul.subnav, li a:hover {
     color:#167B9F;
     list-style-image: url(images/content_nav_bullet.jpg);
}
0
 
LVL 5

Expert Comment

by:php-webdesign
ID: 12643297
strange...

W3C CSS Validator Results for file://localhost/test.css
No error or warning found

To work as intended, your CSS style sheet needs a correct document parse tree. This means you should use valid HTML.

are you using the right doctype??

http://validator.w3.org/
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:tingleweb
ID: 12643338
Can you use the validator with CSS files?
0
 

Author Comment

by:tingleweb
ID: 12643341
It works fine in IE, by the way...
0
 
LVL 5

Expert Comment

by:php-webdesign
ID: 12643365
on w3c.org there is a CSS validator :)

let me look for a mozilla bug or something
0
 
LVL 5

Expert Comment

by:php-webdesign
ID: 12643393
i can only find problems with this issue for IE:

http://www.experts-exchange.com/Web/Web_Languages/CSS/Q_21175675.html

but maybe it helps you
0
 
LVL 31

Assisted Solution

by:seanpowell
seanpowell earned 1000 total points
ID: 12643528
Tingleweb,

Your containing ul has this declaration:

ul#mainnav ul.subnav
{
     list-style: none;
}

so you can't have a list style image without a list style.

Use this instead:

ul#mainnav ul.subnav li a:hover
{
      color:#167B9F;
      background: url(images/content_nav_bullet.jpg) no-repeat 4px 12px;
}


and you need to remove the commas from this rule:
ul#mainnav, ul.subnav, li a:hover

Thanks,
Sean
0
 
LVL 17

Accepted Solution

by:
mreuring earned 1000 total points
ID: 12643656
Based on Sean's solution, you might also want to create a bit of spacing to place the bullet in front of the link:

ul#mainnav ul.subnav li a:hover
{
     color:#167B9F;
     background: url(images/content_nav_bullet.jpg) no-repeat 4px 12px;
     margin-left: -15px;
     padding-left: 15px;
}

Oh and even if a list-style was valid, mozilla would likely have rendered quite differently from IE as the 'a'-tag is targetted on hover and not the 'li'. I realise that this was done for IE's sake, but you should realise the impact.

Just thought I'd mention it :)

  Martin
0
 

Author Comment

by:tingleweb
ID: 12652309
The background tag doesnt give the same desired effect as list-style-image does in IE.

I dont understand why the list-style-image doesnt work in Mozilla in my case - it should.

Is there any more info I could provide that would help you spot whats causing it not to work?

Your help is very much appreciated

- alicia
0
 
LVL 31

Assisted Solution

by:seanpowell
seanpowell earned 1000 total points
ID: 12653597
It's not working because it's not supposed to...

<a> tags do not have a value of list-style-image.

IE displays the image on hover, but that browser would probably spin your monitor around if you added screen-type:upside-down. (Although I'm afraid to test that last one...)

This:
background: url(images/content_nav_bullet.jpg) no-repeat 4px 12px;

gives you much better control over where the bullet appears cross-browser, and is syntactically correct as there's nothing wrong with adding a background to the <a> tag. If you are getting strange results with this, it's just some of the other settings that you are using that's throwing it off.

Sean
0
 

Author Comment

by:tingleweb
ID: 12662944
Well done guys!!

I tweaked the margin/padding and yes it works lovely

Thank you for all your help Sean & Martin

0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When writing CSS, there are a few simple rules that will make your life easier.    1. Using ‘* {box-sizing:border-box;}’. Using this will wrap all your elements in a nice little compact box-model that will give you the width you want, like so... …
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
Suggested Courses
Course of the Month14 days, 16 hours left to enroll

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question