-
On a website, what is the purpose of HTML code?
HTML's purpose on a website is to define the page structure.
-
What is the difference between an element and a tag?
HTML tag is just opening or closing entity
<p></p>
. HTML element consist of opening tag, closing tag, content (optional for content-less tags).<p>I am an element</p>
-
Why do we use attributes in HTML elements?
The purpose of attributes is to provide additional information about the contents of an element.
-
Describe the purpose of the head, title, and body HTML elements.
The
head
element contains information that is relevant to the page such as the title element.The
title
defines a websites title and is displayed at the top of the browser.The
body
element is where all visible on the page HTML mark up will be placedHTML elements indicate that anything held between the opening and closing tag is HTML code.
-
In your browser (Chrome), how do you view the source of a website?
By right clicking and selecting view source or by opening devtools and navigating to the source.
-
List five different HTML elements and what they are used for. For example,
<p></p>
.<html></html>
Holds all visiblehtml
markup to be displayed in the browser.<h1>
is a top level heading used to display titles.<a>
is a link tag for creating links.<p>
is a paragraph tag and used to display text.<ul>
is an unordered list used to display lists without a particular order.
-
What are empty elements?
Empty elements that do not have any words between an opening and closing tag.
-
What is semantic markup?
Semantic markup provides extra information about the HTML page.
-
What are three new semantic elements introduced in HTML 5? Use page 431 in the book to find more about these new elements.
<header>
,<section>
, and<aside>
are all new HTML5 elements.
-
There are three main types of lists in HTML: ordered, unordered, and definition. What are their differences?
The main differences
ordered
lists are lists where each item in the list is numbered,unordered
lists are lists that begin with a bullet point rather than a character, anddefinition
are made up of a set of terms along with the definitions for each of those terms.
<ol>
<li>Steps in a recipe</li>
<li>Steps in a recipe</li>
<li>Steps in a recipe</li>
</ol>
<ul>
<li><a href="#">Link to somewhere</a></li>
<li><a href="#">Link to somewhere</a></li>
<li><a href="#">Link to somewhere</a></li>
</ul>
<dl>
<dt>Term to be defined</dt>
<dd>Definition of term/.</dd>
</dl>
-
What is the basic structure of an element used to link to another website?
The basic structure of the
<a>
element is<a href"link_here">LINK_TEXT</a>
. -
What attribute should you include in a link to open a new tab when the link is clicked?
You should include the
target
attribute to open a new tab when a link is clicked. -
How do you link to a specific part of the same page?
You can link to a specific part of a page by using an
id
attribute.
-
What is the purpose of CSS?
The purpose of
CSS
is to styleHTML
. -
What does CSS stand for? What does cascading mean in this case?
CSS
stands for Cascading Style Sheets. -
What is the basic structure of a CSS rule?
The structure of a
CSS
rule contains a selectorh1
and a decelerationcolor: red
. This will result in allh1
's being the color red.
h1 {
color: red
}
-
How do you link a CSS stylesheet to your HTML document?
You can link a
CSS
stylesheet to anHTLM
file with alink
element and the path to your stylesheet.
<link rel="stylesheet" href="styles.css">
-
What is it useful to use external stylesheets as opposed to using internal CSS?
It is user to use external stylesheets to separate concerns and to keep with using the
DRY
method.HTLM
files forHTML
,CSS
forCSS
and so on. -
Describe what a color hex code is.
These are six-digit codes that represent the amount of red, green and blue in a color, preceded by a pound or hash # sign.
-
What are the three parts of an HSL color property?
HUE
is expressed as an angle (between 0 and 360 degrees).SATURATION
is expressed as a percentage.LIGHTNESS
is expressed as a percentage with 0% being white, 50% being normal, and 100% being black. -
In the world of typeface, what are the three main categories of fonts? What are the differences between them?
Serif
fonts have extra details on the ends of the main strokes of the letters. These details are known as serifs.Sans-serif
fonts have straight ends to letters, and therefore have a much cleaner design.Monospace
(or fixed-width) font is the same width. (Non-monospace fonts have different widths.) -
When specifying font-size, what are the main three units used?
The three main units user are
Pixels
,Percentages
, andEms
.
-
If you're using an input element in a form, what attribute controls the behavior of that input?
The
type
attribute controls the behavior theinput
. -
What element is used to create a dropdown list?
The
select
element is used to create a dropdown list.
<form action="http://www.example.com/"*
<p*Please choose an option</p*
<select name="devices"*
<option value="ipod"*iPod</option*
<option value="radio"*Radio</option*
<option value="computer"*Computer</option*
</select*
</form*
-
If you're using an input element to send form data to a server, what should the type attribute be set to?
The form should have an
action
, and amethod
and thetype
should correspond with what ever kind of input is being used.
<form action="/signup" method="post"*
First name: <input type="text" name="first-name"*
<input type="submit" value="Submit"*
</form*
-
What element is used to group similar form items together?
The
fieldset
element is used to group similar form items together.
-
Describe the differences between border, margin, and padding.
The
border
separates the edge of one box from another. Themargin
sits outside the edge of the border. You can set the width of a margin to create a gap between the borders of two adjacent boxes. Thepadding
is the space between the border of a box and any content contained within it. -
For a CSS rule padding: 1px 2px 5px 10px, what sides of the content box does each pixel value correspond to?
The rule
padding: 1px 2px 5px 10px
is the same as writing
.my-styled-div {
padding-top: 1px;
padding-right: 2px;
padding-bottom: 5px;
padding-left: 10px;
}
-
Describe the different between block-level and inline elements.
Block-level boxes take up a new line, while inline boxes fit between surrounding text.
-
What is the role of fixed positioning, and why is z-index important in the scenario of using fixed positioning?
By setting a
position: fixed;
on an element that element will not scroll with the rest of the page. When you move any element from normal flow, boxes can overlap. Thez-index
property allows you to control which box appears on top. -
What is the difference between a fixed and liquid layout?
Fixed width layout designs do not change size as the user increases or decreases the size of their browser window. Liquid layout designs stretch and contract as the user increases or decreases the size of their browser window. They tend to use percentages.
-
In an image element, why is the alt attribute important?
The
alt
attributed is important to assist screen reading tech in describing a picture to a user, and provides a text description of the image which describes the image if you cannot see it. -
What determines if an image element is inline or block?
An image's display is affected by the surrounding elements. If the
<img>
element is inside a block level element, any text or other inline elements will flow around the image. If the<img>
is followed by a block level element (such as a paragraph) then the block level element will sit on a new line.<!-- Image inline --> <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Dignissimos <img src="image.src" alt="I am an image">iste quaerat distinctio veritatis at debitis excepturi, nostrum </p> <!-- New Link for an Image --> <h1>Image Heading</h1> <img src="image.src" alt="I am an image">
-
What are the benefits of jpg or png image file formats?
The benefits of using
jpg
orpng
can help the browser display the image correctly.png
is best for flat color andjpg
is best for images with many colors .
-
What is the benefit of specifying the height and width of images in CSS compared to specifying in the HTML?
You can specify many different
img
sizes in yourCSS
to show different sized images based on screen size, also you maintain separation of concernse by usingCSS
for styling purposes andHTML
for markup purposes. -
What is an image sprite, and why is it useful?
When a single image is used for several different parts of an interface it is known as
sprite
The advantage of usingsprite
s is that the web browser only needs to request one image rather than many images, which can make the web page load faster.
-
There are three big data types in JavaScript: numbers, strings, and booleans. Describe what each of them are.
Values of the number type are numeric values such as
1
. Values of the type string are used to represent text an is the text/numbers between single/double quotes"Andrew" === 'Andrew'
. Values of the type of booleans are represented withtrue
orfalse
. -
What are the three logical operators that JavaScript supports?
The three logical operators are and
&&
, or||
, and not!
. -
What is the naming convention used for variables?
Camel case is used for naming variables in JavaScript.
const firstName = "Andrew"
-
What is the difference between an expression and a statement?
A fragment of code that produces a value is called an expression
1
. A statement is an expression with a semicolon after it1;
. -
What are a few JavaScript reserved words, and why are they important to avoid using them for variable names?
It is important to never use reserved words as variables as they are officially not allowed to be used in that sense, and will cause a program to fail or cause unwanted side effects.
break case catch class const continue debugger default delete do else enum export extends false finally for function if implements import in instanceof interface let new null package private protected public return static super switch this throw true try typeof var void while with yield
-
What is control flow, and why is it useful for programming?
Control flow allows the programmer to control how a program will run by introducing disturbances through the use of conditional (
if
,else
, andswitch
) and looping (while
,do
, andfor
) statements.
- If we have a function defined as function sayHello(){console.log("Hello!")}, what is the difference between entering sayHello and sayHello() in the console?
Entering
sayHello
will in the console will display what sayHello is, as opposed tosayHello()
will call the functionsayHello
.
sayHello;
ƒ sayHello(){console.log('hello')}
sayHello();
hello
undefined
- What is the keyword return used for?
A
return
statement determines the value the function returns.
- What are function parameters?
Parameters are like regular variables, but their values are given by the caller of the function, not the code in the function itself.
- What is the naming convention used for function names?
The naming convention for functions is camelCase.