It keeps saying Oops, try again. Do your <a> tags all have href attributes?


#1

<!DOCTYPE html>
<html>
	<head>
		<link type="text/css" rel="stylesheet" href="stylesheet.css"/>
		<title>Result</title>
	</head>
	<body>
		<!--Add your HTML below!-->
		<ul>
		<li><a id="a" href="aa">aa</a></li>
		<li><a id="b" href="bb">bb</a></li>
		<li><a id="c" href="cc">cc</a></li>
		</ul>
	</body>
</html>

WHY can't I use "id" to designate my anchor element? The result of my code is right but it can't pass
#2

Please post your code.


#3

i think the checking script might have difficulties because of the id's you added, try removing the id's


#4


WHY can't I use "id" to designate my anchor element? The result of my code is right but it can't pass.
It keeps saying:Oops, try again. Did you remember to set your first <a> to the color #CDBE70?But my color
did change to the right one.


<!DOCTYPE html>
<html>
	<head>
		<link type="text/css" rel="stylesheet" href="stylesheet.css"/>
		<title>Result</title>
	</head>
	<body>
		<!--Add your HTML below!-->
		<ul>
		<li><a href="ddd" id="v">Soft-Lipa</a></li>
		<li><a href="ccc">MC Hot Dog</a></li>
		<li><a href="aaaa" id="g">MJ116</a></li>
		</ul>
	</body>
</html>


#5

which exercise is this?


#6

CSS selectors
Lesson 18


#7

could be you hit a glitch, try a different browser. Can i also see your css code?


#8

a:hover{
  text-decoration: none;  
}
#v{
  color: #cdbe70;
}
#g{
    color: #ffc125;  
}

#9

please don't use id in this lesson, it is just not going to work. use nth-child


#10

Because the result is correct,it just don't let me pass.
So I was just wondering if "id" atttribute could be applied to anchor element.


#11

but there is a problem, this exercise restricts you in what you can do (if we have to validate every possible way this can be achieved, the checking script becomes massive)

The exercise assumes you nest your anchor elements directly in your body:

<body>
  <a href='url'>click here</a>
  <a href='url'>click here</a>
  <a href='url'>click here</a>
</body>

in which case first and third child work fine. In your case, all your anchor elements are first of <li>

what you could do (this won't let you pass either) is use the list tags to the count, and then select the anchor elements:

li:first-child a
li:nth-child(3) a

but for the sake of the exercise, please nest the anchors directly into body, and don't use id's.

If you really want the anchors on separate lines add this to css:

a { display: block; }

#12

I got it.Thank you so much!!!