CLASS 03 READING NOTES
LISTS
- Ordered Lists
<ol>
The ordered list is created with the <ol> element.
<li>
Each item in the list is placed between an opening <li> tag and a closing </li> tag. (The li stands for list item.)
- Unordered Lists
<ul>
The unordered list is created with the <ul> element.
<li>
Each item in the list is placed between an opening <li> tag and a closing </li> tag. (The li stands for list item.)
DefinitiOn Lists
-
-
The definition list is created with the
- and
- elements.
- element and usually consists of a series of terms and their definitions.
Inside the
- element you will usually see pairs of
-
- This is used to contain the term being defined (the definition term).
-
- This is used to contain the definition. Sometimes you might see a list where there are two terms used for the same definition or two different definitions for the same term.
Boxes and dimensions width, height
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. The most popular ways to specify the size of a box are to use pixels, percentages, or ems. Traditionally, pixels have been the most popular method because they allow designers to accurately control their size. When you use percentages, the size of the box is relative to the size of the browser window or, if the box is encased within another box, it is a percentage of the size of the containing box. When you use ems, the size of the box is based on the size of text within it. Designers have recently started to use percentages and ems more for measurements as they try to create designs that are flexible across devices which have different-sized screens.
Padding
The padding property allows you to specify how much space should appear between the content of an element and its border. The value of this property is most often specified in pixels (although it is also possible to use percentages or ems). If a percentage is used, the padding is a percentage of the browser window (or of the containing box if it is inside another box).
- p { width: 275px; border: 2px solid #0088dd;} p.example { padding: 10px;}
CREATING AN ARRAY
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. This technique for creating an array is known as an array literal. It is usually the preferred method for creating an array. You can also write each value on a separate line.
OPERATORS
Expressions rely on things called operators; they allow programmers to create a single value from one or more values.
ARITHMETIC OPERATORS
JavaScript contains the following mathematical operators, which you can use with numbers. You may remember some from math class.
-
, - , / , * , ++ , – , % .