reading-notes

Read: 03 - HTML Lists, CSS Boxes, JS Control Flow

Lists:

Unordered HTML List

An unordered list starts with the <ul> tag. Each list item starts with the <li> tag. The list items will be marked with bullets (small black circles) by default:

ordered HTML List

An ordered list starts with the <ol> tag. Each list item starts with the <li> tag. The list items will be marked with numbers by default:

HTML Description Lists

HTML also supports description lists. A description list is a list of terms, with a description of each term. The <dl> tag defines the description list, the <dt> tag defines the term (name), and the <dd> tag describes each term:

Boxes:

Boxes dimenstions:

The width and height you assign to an element is applied only to the element’s content box. div.box { height: 300px; width: 300px;

Limiting Width:

The max-width CSS property sets the maximum width of an element. It prevents the used value of the width property from becoming larger than the value specified by max-width.

min-width The min-width property defines the minimum width of an element. If the content is smaller than the minimum width, the minimum width will be applied.

overflow:

The overflow property specifies what should happen if content overflows an element’s box. This property specifies whether to clip content or to add scrollbars when an element’s content is too big to fit in a specified area.

Note: The overflow property only works for block elements with a specified height.

Value Description
visible The overflow is not clipped. It renders outside the element’s box. This is default
hidden Specifies bold text without any extra importance.
scroll The overflow is clipped, but a scroll-bar is added to see the rest of the content
auto If overflow is clipped, a scroll-bar should be added to see the rest of the content
initial Sets this property to its default value.
inherit Inherits this property from its parent element.

Border The CSS border properties allow you to specify the style, width, and color of an element’s border. The border-style property specifies what kind of border to display.

Margin The margin property sets the margins for an element, and is a shorthand property for the following properties:

If the margin property has four values:

Padding The padding property is a shorthand property for:

If the padding property has four values:

margin, border, and padding

Border Images The border-image property allows you to specify an image to be used as the border around an element.

Box-shadow The box-shadow property attaches one or more shadows to an element.

Rounded Corners The CSS border-radius property defines the radius of an element’s corners. This property allows you to add rounded corners to elements.

JS Decisions and Loops

Switch statement:

A switch statement starts with a variable called the switch value. Each case indicates a possible value for this variable and the code that should run if the variable matches that value.

Syntax switch(expression) { case x: // code block break; case y: // code block break; default: // code block }

Switching Details

Strict Comparison

Loops:

Loops are handy, if you want to run the same code over and over again, each time with a different value.

For loop The for loop has the following syntax: for (statement 1; statement 2; statement 3) { ` // code block to be executed }`

While loop The while loop loops through a block of code as long as a specified condition is true. Syntax while (condition) { // code block to be executed }

do/while loop The do/while loop is a variant of the while loop. This loop will execute the code block once, before checking if the condition is true, then it will repeat the loop as long as the condition is true. Syntax do { ` // code block to be executed } while (condition);`

Do not forget to increase the variable used in the condition, otherwise the loop will never end!