HTML and CSS Reference
In-Depth Information
Correct answer: C
Incorrect: <div> elements flow left to right and top to bottom and don't provide
any structure.
Incorrect: The <p> element denotes a paragraph. This element doesn't provide
any layout structure to the page.
Correct: You use the <table> element to provide a structured layout, using its
rows and columns elements as needed to create the desired layout.
Incorrect: The <form> element is used to denote an area where the user can sub-
mit data. The <form> element doesn't provide any mechanism to control layout.
Objective 1.2: Thought experiment
This thought experiment speaks directly to performance. As the number of balls increases,
the demand on the graphics engine and local resources such as CPU and memory becomes
more intense. The <canvas> element is better designed to perform this duty. From a coding
perspective, this experiment provides insight into capturing events from the canvas, calcu-
lating the location of the click in relation to the balls on the screen, and creating new balls
dynamically as they get clicked. These computations need to occur quickly as the graphics
are redrawn. The implementation of such a game would be too involved for the scope of
this topic. However, the notion of performance is an important concept to be clear on with
respect to graphics rendering.
Objective 1.2: Review
Correct answer: D
Incorrect: The getElementById method retrieves an element by its unique id .
Incorrect: The querySelector method retrieves a single element that matches the
specified selector.
Incorrect: The getElementsByClassName method retrieves all the elements that
have the specified CSS class assigned to them.
Correct: The queryAll method isn't available to search the DOM.
Correct answer: A
Correct: document.getElementbyId(“myDog”); retrieves only the single image with
the ID myDog .
Incorrect: <p>.getChildNode(“img”); isn't a valid syntax.
Incorrect: document.getElementbyId(“dogs).querySelector (“thumb”); fails
because the page has no element named “dogs”.
Incorrect: document.querySelector.querySelectorAll(“thumb”); is incorrect
because it returns all the elements on the page with the specified class name.
Search WWH ::

Custom Search