70-480 Exam QuestionsBrowse all questions from this exam

70-480 Exam - Question 41


You implement an application by using HTML5 and JavaScript. You create a webpage that contains the following HTML:

Exam 70-480 Question 41

The application must place a border on only the first UL element that is contained in the DIV element.

You need to update the webpage.

What should you do?

Exam 70-480 Question 41
Show Answer
Correct Answer: B

To place a border on only the first UL element contained in the DIV element with an id of 'container,' you need to use a CSS selector that specifically targets the UL element directly under the DIV element with the id 'container'. The correct jQuery selector for this purpose is '#container > ul'. This will ensure that only the first UL element inside the DIV element gets styled with a border. None of the CSS suggestions or the other jQuery selectors provided are as precise for this requirement.

Discussion

7 comments
Sign in to comment
Etnic
Nov 13, 2019

correct answer is B : .container is for class. There is id="container" which is #container

techabilla
Oct 30, 2019

Answer D is incorrect. The selector ".container ul" will not work, because the <div> does not have a class attribute. I believe answer B will work since the selector "div#container ul" will select the <ul> inside the <div> with id="container".

JackJack74
Jan 4, 2020

I went and tested all options, And B is the only correct answer

zara01
Jul 25, 2020

Why cant it be C? first ul element of its parent (div)??

zara01
Jul 25, 2020

Sorry i understand now its because both ul's are the first ul's of their parent. First ul of div and first ul of li

PHULU
Sep 23, 2020

Answer D id wrong the selector ".container " is not a class its an id element , it should be #container. i think c is correct

alexcode
Dec 3, 2020

$("div#container > ul").css("border", "1px solid black"); - Correct, i Tested

Lercoo_1728
Jan 14, 2021

correct answer is "D". The CSS file is an external one, so only option "C" is correct.