CSS/HTML/JavaScript
What is the syntax for an embedded expression in JavaScript?
${expression}
How would you indicate both .class2 should be a descendant (nested under) .class1 when selected in a CSS rule?
.class1 .class2 (space between them)
How would you indicate both classes .class1 and .class2 are to be selected in a CSS rule?
.class1.class2 (run together)
What are the two purposes for including the alt attribute?
1. So readers for the visually impaired can be used to identify the image, area, or input 2. To show relevant text information if the element containing the attribute does not render correctly
What is each of the three clauses in the for statement of. a for loop called?
1. initializer (or initialization) 2. condition 3. afterthought (or incrementation)
An image map, with clickable areas:
<area>
What do each of these combinators mean: <space>, >,
<space> --> nested, all descendants > --> direct child + --> adjacent sibling ~ --> all siblings
What is the condition in the for statement of a for loop?
A boolean expression which stops the loop when it evaluates to false
What can be a module in JavaScript?
A file or a script
How does this code work to return the highest number?
Because each time the loop is iterated through, myHand[0] is assigned the next element in the array.
What is CSS?
Cascading Stylesheets is a declarative language used by a browser to style a web page, overwriting rules for HTML elements in cascading layers of increasing selector specificity and source precedence. CSS rules will be inherited by child nodes of these elements.
What's the difference between block and inline-block?
Compared to display: block , the major difference is that display: inline-block does not add a line-break after the element, so the element can sit next to other elements.
What's the difference between inline and inline-block?
Compared to display: inline , the major difference is that display: inline-block allows to set a width and height on the element. Also, with display: inline-block , the top and bottom margins/paddings are respected, but with display: inline they are not.
What's the difference between inline, inline block, and block?
In line will flow with the text (in p tags in all examples here) before and after it. Inline block will start after text but bring up the text after it Block will be completely separate, on separate lines, from text before and after https://www.w3schools.com/cssref/pr_class_display.asp
What is the purpose of the HTML lang attribute's identification of text content for the related web page?
It helps search engines return language specific results, It is used by screen readers that switch language profiles to provide the correct accent and pronunciation
What does the afterthought in the for statement in a for loop do?
It runs at the end of each cycle of the loop ("this is how I get from where I start to where I stop")
What is the initializer in the for statement of a for loop?
It sets a value to start with and runs before the loop
Is the type attribute applied to the style tag necessary?
No, but it can be considered a best practice. The type attribute applied to the style tag has only one acceptable value: text/css . In theory, other types of styling could also be used between style tags-thus the need for a type attribute.
How do you vertically position an element in CSS?
Set an absolute element inside a relative one <!DOCTYPE html> <html> <head> <style> .container { height: 200px; position: relative; border: 3px solid green; } .vertical-center { margin: 0; position: absolute; top: 50%; -ms-transform: translateY(-50%); transform: translateY(-50%); } </style> </head> <body> <h2>Vertical Center</h2> <p>In this example, we use positioning and the transform property to vertically center an element inside a container element:</p> <div class="container"> <div class="vertical-center"> <p>I am vertically centered.</p> </div> </div> </body> </html>
What is the body part of a for loop?
The block of code to execute until the condition is false
What is fall through in a switch case?
When a break statement is reached, the switch terminates, and the flow of control jumps to the next line following the switch statement. Not every case needs to contain a break. If no break appears, the flow of control will fall through to subsequent cases until a break is reached.
Will the default case in a switch statement run if a non-default switch case expression is run but there is no break statement after it?
Yes
Will a web page work even without a DOCTYPE declaration?
Yes, but it's best practice
What are the three parts of a for statement in a for loop called?
clauses
What does <meta name="viewport" content="width=device-width"> do?
ensures sites use the proper width for mobile devices
max - specifies the maximum value allowed min - specifies the minimum value allowed step - specifies the legal number intervals value - Specifies the default value
extra attributes for number and range types
What does the head section of an HTML page contain?
info about the page itself
What is the default value for the display property in XML?
inline, including SVG elements
Name four values for the display property.
none, inline, block, inline-block
Where does the title of an HTML document show up?
the tab of your browser with the favicon
28) Does a <!DOCTYPE html> tag is a HTML tag? No, the <!DOCTYPE html> declaration is not an HTML tag. There are many type of HTML e.g. HTML 4.01 Strict, HTML 4.01 Transitional, HTML 4.01 Frameset, XHTML 1.0 Strict, XHTML 1.0 Transitional, XHTML 1.0 Frameset, XHTML 1.1 etc. So, <!DOCTYPE html> is used to instruct the web browser about the HTML page.
x
Property Inline CSS can be added as an HTML element attribute, known as a property. <div style="border: 1px solid black; font-size: 18px; "> Text </div> Order of precedence Within a specificity level, which rules overwrite others is based on the last rule to be parsed, starting from the top of a style sheet or block to the bottom, and which sheet is loaded last. Rule In a <style> block or external .css file, CSS is defined by a rule made up of a selector and key-value settings. div { border : 1px solid black; font-size : 18px; } Selectors include: Universal: * Element: html, div, p Class: .class-name Id: #id-name Attribute: [attribute-key] And can be grouped using ,: div, li { ... } Or target child elements of a specific selector: .class-name > li { ... } Or descendants of a selector: li a { ... }
xxx