This forum is now read-only. Please use our new forums! Go to forums
Full Monty or briefs?
In an earlier exercise we were taught that a p is targeted within nested divs like so: div div p. This seems to say that to target a nested element you should cite its full pedigree. Accordingly, in this exercise I used body ul li a to target the required a. This passes, but so does simple li a. Is the more elaborate selector better practice or is the simplified version good in all cases? Here’s the HTML for reference:
<!DOCTYPE html>
<html>
<head>
<link type="text/css" rel="stylesheet" href="stylesheet.css"/>
<title>Linkapalooza</title>
</head>
<body>
<a href="http://www.codecademy.com/">Codecademy!</a>
<ul>
<li>
<a href="http://www.codecademy.com/learn">Learn</a>
</li>
<li>
<a href="http://www.codecademy.com/create/creator">Teach</a>
</li>
<li>
<a href="http://www.codecademy.com/edit_account/basic_info">Settings</a>
</li>
</ul>
</body>
</html>
Answer 524c8c67f10c60fd920054f2
I would say that the elaborate version would be better practice, I have had doubts like this, that went through on the preview page, but it won’t let me submit it because I forgot something, like a colon during styling let’s say. Different computers have different processers, and honestly the creator put it that way for a reason, so I’d just say that you should leave it how he wants it, he knows more about this coding than you or I combined.
Popular free courses
- Free Course
Learn SQL
In this SQL course, you'll learn how to manage large datasets and analyze real data using the standard data management language.Beginner friendly,4 LessonsLanguage Fluency - Free Course
Learn JavaScript
Learn how to use JavaScript — a powerful and flexible programming language for adding website interactivity.Beginner friendly,11 LessonsLanguage Fluency - Free Course
Learn HTML
Start at the beginning by learning HTML basics — an important foundation for building and editing web pages.Beginner friendly,6 LessonsLanguage Fluency