reading-notes


Project maintained by Razan-am Hosted on GitHub Pages — Theme by mattgraham

HTML & CSS

Chapter 2: “Text”

There is two types of markup :

  1. Structural markup: the elements that you can use to describe both headings and paragraphs.

  2. Semantic markup: which provides extra information;such as quotining something.


1. Structural markup:

Example: <h1>This is a Main Heading</h1>

<h2>This is a Level 2 Heading</h2>

<h3>This is a Level 3 Heading</h3>

<h4>This is a Level 4 Heading</h4>

<h5>This is a Level 5 Heading</h5>

<h6>This is a Level 6 Heading</h6>

Example: <p>Text is easier to understand when it is split up into units of text. For example, a book may have chapters. Chapters can have subheadings. Under each heading there will be one or more paragraphs.</p>

Example: <p>Inside a product description you might see some <b>key features</b> in bold.</p>

-For the italic style you need to include it inside <i> tag.

Example: <p>Captain Cook sailed to Australia on the <i>Endeavour</i>.</p>

Example: <p>On the 4<sup>th</sup> of September you will learn about E=MC<sup>2</sup>.</p> <p>The amount of CO<sub>2</sub> in the atmosphere grew by 2ppm in 2009<sub>1</sub>.</p>

Example: <p>The Earth<br/>gets one hundred tons heavier every day<br/>due to falling space dust.</p>

Example: <p>Venus is the only planet that rotates clockwise.</p>

<hr/>

<p>Jupiter is bigger than all the other planets combined.</p>


2. Semantic markup:

<It is abou the elements that don't affect the structure of your web pages, but they do add extra information to the pages .>

Examples:

  • <p><strong>Beware:</strong> Pickpockets operate this area.</p>

Examples:

  • <blockquote cite="http://en.wikipedia.org/wiki/Winnie-the-Pooh">

<p>Did you ever stop to think, and forget to start again?</p>

</blockquote>


Examples:

  • <p><abbr title="Professor">Prof</abbr> Stephen Hawking is a theoretical physicist and cosmologist.</p>

Examples:

  • <p><cite>A Brief History of Time</cite> by Stephen Hawking has sold over ten million copies worldwide.</p>

Example: <address>

<p><a href="mailto:homer@example.org">

homer@example.org</a></p>

<p>742 Evergreen Terrace, Springfield.</p>

</address>

Examples:

  • <p>It was the <del>worst</del> <ins>best</ins> idea she had ever had.</p>

<p><s>Was $995</s></p>

<p>Now only $375</p>

<So the HTML elements are used to describe the structure of the page (e.g. headings, subheadings, paragraphs).And they also provide semantic information (e.g. where emphasis should be placed, the definition of any acronyms used, when given text is a quotation).>

- A full example to shown a demonstrates text markup:

<html>

<head>

<title>Text</title>

</head>

<body>

<h1>The Story in the Book</h1>

<h2>Chapter 1</h2>

<p>Molly had been staring out of her window for aboutm an hour now. On her desk, lying between the copies of <i>Nature</i>, <i>New Scientist</i>, and all the other scientific journals her work had appeared in, was a well thumbed copy of <cite>On The Road</cite>. It had been Molly’s favorite book since college, and the longer she spent in these four walls the more she felt she needed to be free.</p>

<p>She had spent the last ten years in this room,sitting under a poster with an Oscar Wilde quote proclaiming that <q>Work is the refuge of people who have nothing better to do</q>. Although many considered her pioneering work, unraveling the secrets of the llama <abbr title="Deoxyribonucleic acid">DNA</abbr>, to be an outstanding achievement, Molly <em>did</em> think she had something better to do.</p>

</body>

</html>


**Chapter 10:“Introducing CSS” **


Such as :

  1. BLOCK & INLINE ELEMENTS
    • Block level elements look like they start on a new line taking the full width,like: <h1>-,<h6>, <p> and <div> elements
    • Inline elements flow within the text and do not start on a new line taking only the content width,like : <b>, <i>,<img>, <em> and <span>

Example Styles:

  • Boxes:
  • Width and height
  • Borders (color, width, and style)
  • Background color and images
  • Position in the browser window.
  • Text :
    • Typeface
    • Size
    • Color
    • Italics, bold, uppercase,
    • lowercase, small-caps
  • Specific :
    • Lists
    • Tabels
    • Forms

CSS associates style rules with HTML elements :

CSS properties affected of how the elements are displayed

Examples: HTML file:

<!DOCTYPE html>

<html>

<head>

<title>Introducing CSS</title>

<link href="css/example.css" type="text/css"

` rel=”stylesheet” />`

</head>

<body>

` <h1>From Garden to Plate</h1>`

<p>A

<i>potager</i> is a French term for an ornamental vegetable or kitchen garden ... </p>

<h2>What to Plant</h2>

<p>Plants are chosen as much for their functionality as for their color and form ... </p>

</body>

</html>

CSS file: body {

font-family: Arial, Verdana, sans-serif; } h1, h2 {

color: #ee3e80; } p {

color: #665544; }


  1. Inline : by applying the style directly to the element in tag .

  2. Internal CSS: include CSS rules within an HTML page by placing them inside a <style> element, which usually sits inside the <head> element of the page.

  3. External CSS : using the <link> element in the HTML document to tell the browser where to find the CSS file that is used to style the page.


CSS Selectors:


Inheritance:


An Overall


JAVASCRIPT

Chapter 2: “Basic JavaScript Instructions”

<img src=”images/3.PNG” hight=”150px Width=”250px”>

<img src=”images/4.PNG” hight=”150px Width=”250px”>

For example: var variable name = ‘variable value’; var age = ‘35’;

For exampels : var price = 5; var quantity = 14;

For example : var username = ‘Molly’; var message = ‘See our upcoming range’;

For exampel: var title = “Molly’s Special Offers” ; var message = ‘<a href="sale .html">25% offl</a>’

For exampel: var i nStock = true; var shipping = = false;

For exampel: var price = 5; var quantity = 14; var total = price * quantity;


// Create the array var colors = [‘white’,’black’ ,’custom’]; // Update the third item in the array colors[2] = ‘beige ‘ ; //Get the element with an id of colors var el = document .getElementByid(‘ colors’) ; //Replace with third item from the array el .textContent = colors[2];


** EXPRESSIONS:**

** OPERATORS:**

- Arithmetic operators :

Example for arithmetic operator: // Subtotal is 70 var subtotal (13 + 1) * 5; // Shipping is 7 var shipping 0.5 * (13 + 1) ; // Total is 77 var total subtotal + shipping ;

var el Sub document .getElementByid(‘ subtotal ‘) ; elSub .textContent =subtotal ;

var elShip = document .getElement Byid(‘shi ppi ng ‘) ; elShip.textContent =shipping;

var elTotal = document .getElementByid(‘total ‘); elTotal .textContent =total;


- Srting operator :

Example: var greeting= ‘Howdy ‘; var name= ‘Mol ly’ ; var welcomeMessage = greeting+ name+ ‘!’; var el = document.getElementByld(‘greeting’); el .textContent = welcomeMessage;


Chapter 4: “Decisions and Loops”

A switch statement starts with a variable called the switch value.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.

switch (level) {

case ‘One ‘: title= ‘Level 1 ‘ ; break;

case ‘Two’: tit 1 e = ‘ Level 2 ‘ ; break;

case ‘ Three’ : title = ‘Level 3’ ; break ;

default : title= ‘Test’; break;

}

You have a default option that is run if none of the cases match. If a match is found, that code is run; then the break statement stops the rest of the switch statement running (providing better performance than multiple if statements).

References:

@Jon Duckett/HTML & CSS

@Jon Duckett/JAVASCRIPT