2 replies [Last post]
Brasil
Offline
newbie
Last seen: 18 years 16 weeks ago
Joined: 2004-06-15
Posts: 1
Points: 0

Hi guys, I'm a new member of this forum but not so new to css.
I need some help and advice on this matter, and searching the forum I didn't find anything like this.
Here's the deal:

I'm building a WYSIWYG editor in my site, and I need to change some background images according to what the user selects.

I've got a table that has a classname and I can change it's background image changing it's class, and inside this table, there are 5 cells with some links. The font color and the font onMouseOver Color of the links I change with no problem via DOM, but when it comes to changing the bagkground image of that cells, it becomes a problem.
The thing is, the background image of the whole table will remain the image that the user requested, and the links will have the font color and the font onmouse over color that the user request, the background image of the cells will have to be what the user requests too, but the links (a tags) overwrite any background image that I try to put inside the table cell.

The code is too long for me to post it, but here's a link of what I'm trying to do , take a look and you'll see what i mean.

www.tacti.com.br/adrianteste/templatestest.shtml

click on the right image and it will open the editor. The source code can be accessed from there.

Now here's my question:
Does the class of the a tag overwrite all the classes below it ?
I mean, if it is inside a table cell, does the class of the link overwrites the class of the td ?
Can I make a class for the td and just modify it's background image url, or will I have to write several styles and change the class every time the user selects the kind of menu he want's ?
I tried to write a div inside the table cell and modify it's class as the user selects some data, but the a tag still overwrite it and i can't make the image to swap on mouse over.
Any ideas or suggestions ?

Tony
Tony's picture
Offline
Moderator
Brisbane
Last seen: 1 week 6 days ago
Brisbane
Timezone: GMT+10
Joined: 2003-03-12
Posts: 5344
Points: 2965

Multiple Classes within a table

Hi Brasil,
There is many things that you need to consider.
It might be best to buy a book or do some searching but here's the basics.
CSS rules are given a weight based on specifity and other factors.
Inside tables things can get a little confusing so lets ignore them for the moment.
<body><div><p><a class="alink>
There is many ways to target the alink class from above.
Firstly you could just use a{
Or to be more specific a.alink{
You could also continue on your quest for specifity like
div p a.alink{
There's other factors that come into play such as maring a rule !important.
Or using different selectors.

Here's a great article that will explain thing better http://css.maxdesign.com.au/selectutorial/

I think specifity broke the spellchek, surely it's a word Sad

Hope that helps

Hugo
Hugo's picture
Offline
Moderator
London
Last seen: 7 years 39 weeks ago
London
Joined: 2004-06-06
Posts: 15668
Points: 2806

Multiple Classes within a table

Tis a word, but you left out the last 'c'.
but it's impossible to pronounce anyway!!!

Before you make your first post it is vital that you READ THE POSTING GUIDELINES!
----------------------------------------------------------------
Please post ALL your code - both CSS & HTML - in [code] tags
Please validate and ensure you have included a full Doctype before posting.
Why validate? Read Me