Skip navigation
cdouesnard
Currently Being Moderated

css class and id problem

Jun 1, 2012 6:46 PM

Tags: #class #images #css #menu #id

Ok, I've got this weird problem : the main menu bar of my website is styled with css. I had first defined it with classes and everything was fine. When I understood that id's were for unique elements in a page, so I changed all the classes of this menu, on every page, and replaced them with id's. I also changed the dot for a #, in my css file. BUT... now, it works fine on my desktop computer but not on my laptop!!

 

On my laptop : the menu on index.html doesn't work, but it works on all of the other pages.

 

On my desktop, it's the opposite!! index.html is perfect, but there is no menu on the other pages (except for the button of the active page, which is not a class nor an id but a simple image).

 

On the two computers, I tested on explorer, firefox and safari.

 

What's weird, is when I change back ids for classes, the problem is inverted : where the index was ok, it doesn't work and vice versa.

 

So, do you have an idea what might be the problem? I guess it's almost nothing, since everything was perfect just a few hours ago, but I can't figure out how to fix it.

 

Here's the address of the index : http://conser-lsj.org/

And here's the address of one of the pages (because if the index doesn't work, you won't be able to access the other pages) : http://conser-lsj.org/01-html/2Nouvelles-1Dernieres.html

 

 

 

Thank you for your help.

 

Catherine Douesnard

 
Replies
  • Currently Being Moderated
    Jun 1, 2012 7:58 PM   in reply to cdouesnard

    First off, classes can be used anywhere for styling purposes, there is no need to use an ID for this.

     

    ID's are required when manipulating the DOM using scripts. The ID is used to identify a unique element in your document.

     

    The above may be regarded as controversial, but it works and makes it a lot easier to untangle problems associated with styling.

     

    Now for you problem, the page that works uses ID's for the menu, the other page uses CLASS's.

     

    Gramps

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 2, 2012 5:39 PM   in reply to cdouesnard

    Excellent!

     

    Gramps

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points