primefalcon Posted March 9, 2007 Share Posted March 9, 2007 Ok in an external stylesheet I've tried to define the hyperlink colors same as I do in html bodyas follows body {background-image: url('black');background-attachment: fixed;a:link {color: #FF0000}a:visited {color: #00FF00}a:hover {color: #FF00FF}a:active {color: #0000FF}} the actual first alink isn't actually working right and I've I've tried using a separate body just for the link selectors but.... cant get it to work. IS what I'm trying to do possible?sorry to be a pain just in the middle of converting one of my websites over to css and most of it is going great Link to comment Share on other sites More sharing options...
roondog Posted March 9, 2007 Share Posted March 9, 2007 instead of the extra body{} try a{} everything else looks fine. Link to comment Share on other sites More sharing options...
primefalcon Posted March 9, 2007 Author Share Posted March 9, 2007 still not working.i know this style sheet is working and linked properly as all the other things are working just not this hyperlink setting :-S Link to comment Share on other sites More sharing options...
ste Posted March 9, 2007 Share Posted March 9, 2007 no need to put the link styles in the body selector. instead try: body {background-image:url('black'); background-attachment: fixed;}a:link {color: #FF0000}a:visited {color: #00FF00}a:hover {color: #FF00FF}a:active {color: #0000FF} Link to comment Share on other sites More sharing options...
primefalcon Posted March 9, 2007 Author Share Posted March 9, 2007 no need to put the link styles in the body selector. instead try:body {background-image:url('black'); background-attachment: fixed;}a:link {color: #FF0000}a:visited {color: #00FF00}a:hover {color: #FF00FF}a:active {color: #0000FF} so the thing itself acts as the selector, thank you..ok that works, but is there anyway to actually do it so you cal select classes with this? or would I have to do that in a separate stylesheet Link to comment Share on other sites More sharing options...
pulpfiction Posted March 9, 2007 Share Posted March 9, 2007 Are you asking about CSS class for <a>, you can write css classes in the same stylesheet.....CSS:a.classname:link {color: #ff0000}a.classname:active {color: #0000FF}a.classname:visited {color: #00FF00}a.classname:hover {color: #FF00FF}HTML: <a href="someurl" class="classname">Link 1</a>Example:http://www.w3schools.com/css/tryit.asp?filename=trycss_link2 Link to comment Share on other sites More sharing options...
primefalcon Posted March 10, 2007 Author Share Posted March 10, 2007 Ok that is exactly what I need to know, thank you very much.and I actually seen that example but I didn't draw the connectionso say doing this would be no problemCSS:a.main:link {color: #ff0000}a.homelink:link {color: #ff0000}HTML:<a href="someurl" class="main">say page 2</a> <a href="someurl" class="homelink">home</a> Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now