JavaScript and client side scripting.
Moderator: General Moderators
alex.barylski
DevNet Evangelist
Posts: 6267 Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg
Post
by alex.barylski » Sun Oct 12, 2008 10:13 am
Code: Select all
#spectra { /* Apply CSS to a DIV */} #spectra a { /* Apply CSS to a anchors within DIV with ID spectra */}
This is how I have it now unfortnately the CSS for anchors is also being applied to other anchors not just those within #spectra DIV???
How do apply styles to only the anchors within my DIV?
Eran
DevNet Master
Posts: 3549 Joined: Fri Jan 18, 2008 12:36 am
Location: Israel, ME
Post
by Eran » Sun Oct 12, 2008 10:15 am
Your syntax is correct. Make sure: you have correctly closed the spectra div and that the identifier doesn't repeat in the document. Other than that it should work..
alex.barylski
DevNet Evangelist
Posts: 6267 Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg
Post
by alex.barylski » Sun Oct 12, 2008 10:30 am
1. Check
2. Check
But the anchors in a menu are still being styled according to what is only supposed to be applied to anchor's inside <div id="spectra">
I thought I had to do something like:
What is the difference when using the above syntax and what I did earlier?
Eran
DevNet Master
Posts: 3549 Joined: Fri Jan 18, 2008 12:36 am
Location: Israel, ME
Post
by Eran » Sun Oct 12, 2008 10:36 am
div#spectra > a will apply only to anchor elements which are direct decendants of the #spectra div. IE6 by the way doesn't recognize this format.
You might try to reset the styles at the beginning of the stylesheet, giving default to the a in the document and see if it works.
Code: Select all
a {
color:#000;
text-decoration:underline;
}
alex.barylski
DevNet Evangelist
Posts: 6267 Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg
Post
by alex.barylski » Sun Oct 12, 2008 11:06 am
You might try to reset the styles at the beginning of the stylesheet, giving default to the a in the document and see if it works.
Good idea...thanks