reading-notes

Read: 02 - HTML Text, CSS Introduction, and Basic JavaScript Instructions

Text in HTML:

HTML Heading:

HTML headings are defined with the <h1> to <h6> tags. <h1> defines the most important heading. <h6> defines the least important heading. Search engines use the headings to index the structure and content of your web pages.

HTML Paragraphs:

The HTML <p> element defines a paragraph. A paragraph always starts on a new line, and browsers automatically add some white space (a margin) before and after a paragraph.

Element Function
<b> Specifies bold text without any extra importance.
<i> Defines a part of text in an alternate voice or mood. The content of the tag is usually displayed in italic.
<sup> Defines superscript text. Superscript text appears half a character above the normal line, and is sometimes rendered in a smaller font. Superscript text can be used for footnotes, like WWW
<sub> Defines subscript text. Subscript text appears half a character below the normal line, and is sometimes rendered in a smaller font. Subscript text can be used for chemical formulas, like H2O.
<br /> Inserts a single line break.
<hr /> Stands for horizontal rule and is used to insert a horizontal rule or a thematic break in an HTML page to divide or separate document sections.
<strong> gives text a strong emphasis which traditionally means that the text is displayed as bold by the browser.
<em> It renders as emphasized text.
<blockquote> specifies a section that is quoted from another source. Browsers usually indent <blockquote> elements.
<q> Defines a short quotation. Browsers normally insert quotation marks around the quotation.
<abbr> Defines an abbreviation or an acronym, like “HTML”, “Mr.”, “Dec.”, “ASAP”, “ATM”.
<cite> Defines the title of a work (e.g. a book, a song, a movie).
<dfn> Rrepresents the defining instance of a term in HTML. The defining instance is often the first use of a term in a document.
<address> defines the contact information for the author/owner of a document or an article. The contact information can be an email address, URL, physical address, phone number, social media handle.
<ins> Defines a text that has been inserted into a document.
<del> Defines text that has been deleted from a document.
<s> specifies text that is no longer correct, accurate or relevant.
<ins> defines the title of a work (e.g. a book, a song, a movie).

Introducing CSS:

CSS works by associating rules with HTML elements. These rules govern how the content of specified elements should be displayed. A CSS rule contains two parts: a selector and a declaration.

Using external css

HTML: <!DOCTYPE html> <html> <head> <title>Using External CSS</title> <link href="css/styles.css" type="text/css" rel="stylesheet" /> </head> <body> <h1>Potatoes</h1> <p>There are dozens of different potato varieties. They are usually described as early, second early and maincrop.</p> </body> </html> CSS: body { font-family: arial; background-color: rgb(185,179,175);} h1 { color: rgb(255,255,255);}

Using internal css

<!DOCTYPE html> <html> <head> <title>Using Internal CSS</title> <style type="text/css"> body { font-family: arial; background-color: rgb(185,179,175);} h1 { color: rgb(255,255,255);} </style> </head> <body> <h1>Potatoes</h1> <p>There are dozens of different potato varieties. They are usually described as early, second early and maincrop.</p> </body> </html>

CSS Selectors

In CSS, selectors are patterns used to select the element(s) you want to style.

Cascading Order

All the styles in a page will “cascade” into a new “virtual” style sheet by the following rules:

Inheritance

In CSS, inheritance controls what happens when no value is specified for a property on an element. CSS properties can be categorized in two types:

The benefits of using an external style sheet are:

Basic JavaScript Instructions

Comments:

Variables:

JavaScript Variable

Data Types:

JavaScript variables can hold many data types: numbers, strings, objects, Booleans.

Rules for naming variables:

Arrays:

Operators:

Decisions and Loops

Comparison condition:

Logical Operators:

Conditional Statements:

Very often when you write code, you want to perform different actions for different decisions. You can use conditional statements in your code to do this. In JavaScript we have the following conditional statements: