18. Show it if you know it, what's wrong with this code?


#1



What is wrong with the code below


<!DOCTYPE html>
<html>
	<head>
		<link type="text/css" rel="stylesheet" href="stylesheet.css"/>
		<title>Result</title>
	</head>
	<body>
		<!--Add your HTML below!-->
	    <a href="http://facebook.com">facebook<a/>
	    <a href="http://google.com">Google<a/>
	    <a href="http://twitter.com">tweet<a/>
	</body>
</html>

stylesheet/css

a :hover {
    text-decoration: none;
}
a :first-child {
    color: #CDBE70;
}
a :nth-child(3) {
    color: #FFC125;
}


#2

@dasheman,
Try it by closing the a-Tag with </a>
instead of your <a/>


#3

I've changed it to as you suggested, thank you.
However I'm now getting this;

Oops, try again. Did you remember to set your first to the color #CDBE70?


#4

Oops, try again. Did you remember to set your first <> to the color #CDBE70?
It wont let me post the letter a in between the <>


#5

@dasheman,
Either use

a:first-child {
    color: #CDBE70;
}
a:nth-child(3) {
    color: #FFC125;
}

OR

body :first-child {
    color: #CDBE70;
}
body :nth-child(3) {
    color: #FFC125;
}

https://developer.mozilla.org/en-US/docs/Web/CSS/:first-child
https://developer.mozilla.org/en-US/docs/Web/CSS/:nth-child

https://api.jquery.com/first-child-selector/
https://api.jquery.com/nth-child-selector/


#6

That worked, I used the a: which I thought I had. Thanks Leonhard


#7

a:hover {
text-decoration:none;
}

body:first-child {
color: #CDBE70;
}

body:nth-child(3) {
color:#ffc125;
}

I have this and keep getting the same error also.

doesnt instruction 3 specifically say that it's the first child of the body.

So it wouldnt be
A:first-child {
color: #CDBE70;
}


#8

you can use both a:first-child or body :first-child, notice the space, with the space include, it will select any first child inside the element (in this case body), without the space, it will target any anchor elements (<a></a>) who are first child of any parent