Skip to content

Latest commit

 

History

History
97 lines (54 loc) · 3.63 KB

class03.md

File metadata and controls

97 lines (54 loc) · 3.63 KB

Lists

we have three type of list

  1. Numbered lists.
  2. Bullet lists
  3. Definition list There are lots of occasions when we need to use lists. HTML provides us with three different types:

Ordered lists :

The ordered list is created with the ol element.mEach item in the list is placed between an opening li tag and a closing li tag.

Unordered lists:

The unordered list is created with the ul element.,mEach item in the list is placed between an opening li tag and a closing li tag.

Definition lists:

The definition list is created with the dl element and usually consists of a series of terms and their definitions.

Nested Lists:

You can put a second list inside an li element to create a sublist or nested list.

Box Dimensions

By default a box is sized just big enough to hold its contents. To set your own dimensions for a box you can use the height and width properties

Limiting Width

min-width, max-width

Limiting Height

min-height, max-height

Overflowing Content

The overflow property tells the browser what to do if the content contained within a box is larger than the box itself. It can have one of two values:

  1. hidden
  2. scroll

Border, Margin & Padding

  1. border: Every box has a border (even if it is not visible or is specified to be 0 pixels wide). The border separates the edge of one box from another.

  2. Margins sit 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.

  3. Padding is the space between the border of a box and any content contained within it. Adding padding can increase the readability of its contents.

Border Width

thin medium thick

Border Style

solid dotted dashed double groove inset outset hidden / none and you can color it

Hiding Boxes

visibility has tow attribute hidden visible

ARRAYS

An array is a special type of variable. It doesn't just store one value; it stores a list of values. You create an array and give it a name just like you would any other variable (using the var keyword followed by the name of the array). The values are assigned to the array inside a pair of square brackets, and each value is separated by a comma. The values in the array do not need to be the same data type, so you can store a string , a number and a Boolean all in the same array. example var colors; colors ['white', 'black', ' custom'];

VALU ES IN ARRAYS

Values in an array are accessed as if they are in a numbered list. It is important to know that the numbering of this list starts at zero (not one).

SWITCH STATEMENTS If you use a data type JavaScript did not expect.

it tries to make sense of the operation rather than report an error. 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.

TYPE COERCION & WEAK TYPING

If you use a data type JavaScript did not expect, it tries to make sense of the operation rather than report an error.

CHECKING EQUALITY & EXISTENCE

Because the presence of an object or array can be considered truthy, it is often used to check for the existence of an element within a page.

loops

USING FOR LOOPS

A for loop is often used to loop through the items in an array. In this example, the scores for each round of a test are stored in an array called scores.

USING do WHILE LOOPS

The key difference between a while loop and a do while loop is that the statements in the code block come before the condition. This means that those statements are run once whether or not the condition is met.