[HELP] 26. Links and text decoration for CSS


#1

So for the second part of the lesson it says to "On the CSS tab, change your link's text-decoration to none and its color to #cc0000." and I've tried doing it in two ways, both showing errors.

This is in Stylesheet.css

1st try:

a {
    text-decoration: none;
    color: #cc0000;
 }

and it says

Oops, try again.
Did you remember to give your link a 'href' attribute?

2nd Try:

a href {
    text-decoration: none;
    color: #cc0000;
 }

it says

Oops, try again.
    Did you remember to set your link's text-decoration to none;?

This is what I put in the index.html

<!DOCTYPE html>
<html>
    <head><link type="text/css" rel="stylesheet" href="stylesheet.css"/> 
        <title>Result</title>
    </head>
    <body><h1>Hello</h1>
    <p>It's me</p>
    <img src=http://static.idolator.com/uploads/2012/07/03/2-Adele-21-400x300.jpg>
    <div><a href=http://www.facebook.com>Facebook</a></div></body
</html>

I have tried this on FireFox, Google Chrome, and Safari. I have also searched for solutions to this and other people happen to have the same problem. Anyone know a fix to this?


#2

make sure you put elements to the right order example:

<style>
div a {
/* code here
}
</style>

<div>
 <a><img/></a>
</div>

in this case maybe the order is

    <style>
a {
/* code here
}
</style>

<a>
 <p>it's me </p> 
</a>

#3

@obin100, i think i have to disagree here. the link can just contain text, no need to nest an image or paragraph inside your link.

@km25304n, this what you have is correct:

a {
    text-decoration: none;
    color: #cc0000;
 }

when you use a href as css selector, that would mean you need a href element inside your link:

<a><href></href></a>

which is obviously not the code, href is an attribute, not an html element. this error:
Oops, try again.
Did you remember to set your link's text-decoration to none;?
is caused by the fact that you have no quotation marks around your url, your href:

<a href=url>facebook</a>

you need quotation marks around the url:

<a href="url">facebook</a>

same for your image, i think html5 was released after this course was written (html5 allows us to have no quotation marks around certain attribute values). also, your body closing tag is missing a >, it is minor thing, i know, just wanted to point it out


#4

is it solved theres no proof it being solved


#5

tried the first solution..it worked! thanks..


#6

Tried the first solution and it worked!! Thanks.


#7

tommyturndown...Please help to fix this prob as well....Which solution worked for you?


#8

#9

he got the solution from this topic, so you should be able to do this as well? If you can't, make a new topic so we can help you, use the template to make a good topic