reading-notes

https://motaser.github.io/reading-notes/

View on GitHub

list in HTML

There are lots of occasions when we need to use lists. HTML provides us with three different types:

  1. * **Unordered** lists are lists that begin with a bullet point.
    • (rather than characters that indicate order). * **Definition** lists are made up of a set of terms along with thedefinitions for each of those terms.
      . There are threeypes of HTML lists: ordered, unordered, and definition. * Ordered lists use numbers. * Unordered lists use bullets. * Definition lists are used to define terminology. *Lists can be nested inside one another. # Boxes You can set several properties that affect the appearance of these boxes. In this chapter you will see how to: * Control the dimensions of your boxes. * Create borders around boxes. * Set margins and padding for boxes. * Show and hide boxes. ### Border, Margin & Padding **Border** Every box has a border (even ifit is not visible or is specified tobe 0 pixels wide). The border separates the edge of one box from another. **Margin** 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. **Padding** 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. CSS treats each HTML lement as if it has its own box. * You can use CSS to control the dimensions of a box. * You can also control the borders, margin and padding for each box with CSS. * It is possible to hide elements using the display and visibility properties. *Block-level boxes can be made into inline boxes, and inline boxes made into block-level boxes. * Legibility can be improved by controlling the width of boxes containing text and the leading. * CSS3 has introduced the ability to create image borders and rounded borders. # ARRAYS in javascript 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. **VALUES 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). **ACCESSING & CHANGING VALUES IN AN ARRAY** The first lines of code on the left create an array containing a list of three colors. (The values can be added on the same line or on separate lines as shown here.) Having created the array, the third item on the list is changed from 'custom' to 'beige'. # Decisions and Loops **USING IF ... ELSE STATEMENTS** Here you can see that anif ... e 1 se statement al lows you to provide two sets of code: 1. one set if the condition evaluates to true 2. another set if the condition is false. **SWITCH STATEMENTS** 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. **TRUTHY & FALSY VALUES** Due to type coercion, every value in JavaScript can be treated as if it were true or false; and this has some interesting side effects..