Implement and manipulate document structures and objects (24%) Flashcards
Which HTML control defines self-contained areas on a page?
article
Which HTML control defines smaller content areas outside the flow of a webpage?
aside
Which HTML control defines the caption of a figure element?
figcaption
Which HTML control defines content that contains a figure, such as an image, chart, or picture?
figure
Which HTML control defines text that should be highlighted?
mark
Which HTML control defines the bottom of a section or page?
footer
Which HTML control defines the top of a section or page?
header
Which HTML control defines a group of headings (H1–H6 elements)?
hgroup
Which HTML control defines navigation to other pages in the site?
nav
Which HTML control defines the progress of a task?
progress
Which HTML control defines the distinct content of a document?
section
What elements are contained in a basic HTML template?
<!DOCTYPE html> <html> <head> <meta charset="utf-8"/> <title></title> </head> <body> <!-- page content goes here --> </body> </html>
What is the header tag?
Declares a header for any part of the web page. Intended to contain H1-H6, but can contain anything. Does not have to be at the top of the page. Does not actual position the content.
What is the article tag?
Represents a whole and complete piece of content like an article or blog post. Can be taken as-is and used outside the original website.
What is the section tag?
Used to subdivide an article tag.
What is the aside tag?
Contains content outside of the scope of the main content of the page. Does not actual position the content.
How are figure and figcaption tags used together?
<figure>
<img></img>
<figcaption>Fig 1: A really juicy orange.</figcaption>
</figure>
What is the progress tag?
Displays a progress bar. Can be determinate or indeterminate. To make indeterminate, omit the value attribute.
How do you create a determinate progress tag?
<progress></progress>
How do you create an indeterminate progress tag?
<progress></progress>
What is the mark tag?
Highlights a portion of the page.
What tags do search engines primarily look for?
Article and section tags.
Which DOM method gets an individual element on the page by its unique id attribute value
?
getElementById
Which DOM method gets all the elements that have the specified CSS class applied to them?
getElementsByClassName
Which DOM method gets all the elements of the page that have the specified tag name or element name?
getElementsByTagName
Which DOM method gets the first child element found that matches the provided CSS selector criteria?
querySelector
Which DOM method removes an element from the DOM?
removeNode
Which DOM property returns a collection of all child nodes of the parent element?
childNodes
Which DOM property returns a reference to the very first child node in the list of child nodes of the parent node?
firstChild
Which DOM property returns a reference to the very last child node in the list of the child nodes of the parent node?
lastChild
Which DOM property returns true if the parent element has any child nodes at all?
hasChildNodes (A good practice is to check this property before accessing other properties, such as firstChild or lastChild.)
Which attribute to used to tell the browser to include its built-in video controls, such as play and pause?
controls (If this is omitted, the user has no visible way to play the content. You would use autoplay or provide some other mechanism through JavaScript to play the video.)
How do you remove an element and all its descendants from the DOM?
Call removeNode and pass in true.
var innerDiv = document.getElementById("innerDiv"); innerDiv.removeNode(true);
Which HTML tag is used to display video content?
video
<video>
</video>
Which attribute to used to set the source of a video tag?
src
Which attribute to used to start playing the video as soon as it loads?
autoplay (If this attribute is omitted, the video plays only when told to through player controls or JavaScript.)
Which attribute to used to tell the browser to include its built-in video controls, such as play and pause?
controls (If this is omitted, the user has no visible way to play the content. You would use autoplay or provide some other mechanism through JavaScript to play the video.)
Which attributes are used to set the size of the video tag?
height/width
Which attribute to used to continuously play the video after it completes?
loop (If this attribute is omitted, the video stops after it plays through completely.)
Which attribute to used to specify an image to show in the place allocated to the video until the user starts to play the video?
poster (Use this when you’re not using autoplay. It’s very useful for providing a professional image or artwork to represent the video. If it’s omitted, the poster that appears is the first frame of the video.
What tag is used to specify multiple formats for a video tag?
source
<video>
<source></source>
<source></source>
<object>
<p>Video is not supported by this browser.</p>
</object>
</video>
What tag is used to display a message in a browser that does not support the video tag?
object
<video>
<source></source>
<source></source>
<object>
<p>Video is not supported by this browser.</p>
</object>
</video>
What method of the video object plays the video?
play
What method of the video object pauses the video?
pause
What property of the video object controls the volume?
volume
What property of the video object controls the current position of the video?
currentTime
Which HTML tag is used to display graphics?
canvas
<canvas>
Your browser does not support HTML5.
</canvas>
How do you get a reference to the canvas object?
var drawingSurface = document.getElementById("drawingSurface"); var ctxt = drawingSurface.getContext("2d");
Which methods of the canvas object are used to draw a line?
ctxt. beginPath();
ctxt. moveTo(10, 10);
ctxt. lineTo(225, 350);
ctxt. lineTo(300, 10);
ctxt. lineTo(400, 350);
ctxt. lineWidth = 5;
ctxt. strokeStyle = ‘#0f0’;
ctxt. stroke();
Which methods of the canvas object are used to draw a curve?
arc, quadradicCurveTo, and bezierCurveTo
Which parameters are required to draw an arc?
X, Y, radius, startAngle, endAngle, counterclockwise
ctxt. beginPath();
ctxt. arc(150,100,75,0,2 * Math.PI, false);
ctxt. lineWidth = 25;
ctxt. strokeStyle = ‘#0f0’;
ctxt. stroke();
Which parameters are required to draw a quadratic curve?
controlX, controlY, endX, endY
ctxt. beginPath();
ctxt. moveTo(10,380);
ctxt. quadraticCurveTo(300,-250,580,380);
ctxt. lineWidth = 25;
ctxt. strokeStyle = ‘#f00’;
ctxt. stroke();
Which parameters are required to draw a bezier curve?
controlX, controlY, control2X, control2Y, endX, endY
ctxt. beginPath();
ctxt. moveTo(125, 20);
ctxt. bezierCurveTo(0, 200, 300, 300, 50, 400);
ctxt. lineWidth = 5;
ctxt. strokeStyle = ‘#f00’;
ctxt. stroke();