Hello. I'm a web design newbie and was happy to discover this site because I love the idea of CSS and am having fun figuring out how to employ it appropriately. I am hoping that some more experienced designers can help me apply a specific style to a specific kind of link. To allow users to jump to a specific page section- let's call it Leeroy Jenkins- I am currently using
a href=#section1>jump to: Leeroy Jenkins</a>
at the top of the page and
a name=\"#section1\">Leeroy Jenkins</a>
where the section starts.
My style.css page styles links as
#main a { color: #CC3300; text-decoration: underline; font-weight: bold }
. I would like the jump to links at the top of the page and the links at the beginning of each section to NOT be underlined. I understand that there is a way to do this with id or class attributes, but I can't figure out what goes in the html & where and what goes in my style sheet & where.
What I have tried is adding
a.jumpto {text-decoration:none;}
to my style sheet and using
<a href=\"#section1\" class=\"jumpto\">jump to: Leeroy Jenkins</a>
to create the link at the top of the page. This results in the non-underlined style I want for the first link, but the link at the beginning of the section, which is currently
<a name=\"#section1\">Leeroy Jenkins</a>
is still underlined.
I would greatly appreciate your feedback and suggestions. As I'm rather new to this, I'm afraid that I need someone to spell out very specifically what goes where (add ABC to the style sheet, use XYZ where you're currently using [my code]).
My CSS:
body { margin: 0; padding: 0; background: #FFF; font-family: \"arial\", \"verdana\", \"tahoma\", \"times new roman\"; font-size: 90%; color: #444; }
<div id=\"maincont\"> <div id=\"main\"> <a href=\"#section1\">jump to: Leeroy Jenkins</a></p> <a href=\"#section2\">jump to: I Love CSS</a><br/><br/> <h1><a name=\"#section1\">Leeroy Jenkins</a></h1> <p>Here is some stuff about Leeroy Jenkins.</p> <h1><a name=\"#section2\">I Love CSS</a></h1> <p>Here is some stuff about why I Love CSS.</p> </div> </div>
My objective in all this is to differentiate the "jump to" links and their destinations from the other links on my site. Thanks in advance, Melissa
My style.css page styles links as
#main a { color: #CC3300; text-decoration: underline; font-weight: bold }I would like the jump to links at the top of the page and the links at the beginning of each section to NOT be underlined. I understand that there is a way to do this with id or class attributes, but I can't figure out what goes in the html & where and what goes in my style sheet & where.
What I have tried is adding
a.jumpto {text-decoration:none;}I would greatly appreciate your feedback and suggestions. As I'm rather new to this, I'm afraid that I need someone to spell out very specifically what goes where (add ABC to the style sheet, use XYZ where you're currently using [my code]).
My CSS:
And some sample code:
My objective in all this is to differentiate the "jump to" links and their destinations from the other links on my site.
Thanks in advance,
Melissa
Just add the class "jumpto" to all the links that you don't want underlined.
.jumpto {text-decoration: none;}
<a href=\"#section1\" class=\"jumpto\">Leeroy Jenkinds</a>
should do the trick
To get it to work, I ended up having to use
#main a.jumpto {text-decoration: none;}.jumpto {text-decoration: none;}I am assuming that this is okay since it validates and does what I want it to do?
I could not get
Thanks again for the quick and helpful suggestions.
I think you might have the "name" and "href" mixed up.
<a href="#jiggins" class="jumpto">Check out the Jiggins</a> (note how it's still a 'href')
will link to:
<a name="jiggins"></a>This is where your content for the Jiggins section will be. (note how this is 'name')
Because you were putting name="#xxxxx" is probably why it wasn't validating.