Forum Moderators: not2easy

Message Too Old, No Replies

Can't assign css properties to an anchor tag in a list

is it .listname li a {} or what?

         

gilahacker

11:57 pm on Feb 9, 2005 (gmt 0)

10+ Year Member



ok, my site has a main css file that covers most everything.
This stylesheet has a default color of dark blue for <a> (anchor) tags. I have a list in which I want to make all the anchor tags dark red instead and would like to not have to put "style='color:#900'" on every one of them.

I've put this above my list:

<style type="text/css">
.nobullets li {background-image:none; margin:0; padding:0}
</style>

to get rid of the bullets from the main css file.

I've tried

.nobullets li a {}, .nobullets li:a {}, .nobullets li.a {}, etc. ( with color:#900 in the {} ) and can't get any of them to work. (obviously I'm guessing here)

HELP!

Thanks,
-Jason
Webmaster, USFranchiseNews

createErrorMsg

3:27 am on Feb 10, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Your first attempt....nobullets li a {}...should work. Make sure you've placed that rule declaration after the style declaration for all <a>nchors in the css. If the styles for all anchors comes after the .nobullets one in the code, it will override the .nobullets declaration.

If this either isn't the problem or doesn't fix it, try posting your CSS here for us to see.

cEM

MWpro

3:49 am on Feb 10, 2005 (gmt 0)

10+ Year Member



I can't get a feel for what you are saying... post both the relevant css and html for what you are having a problem with.

Make sure the <style> stuff is in the head of the document. From what you said, it seems like you have the <style> stuff directly above your list, and that is not how it works.