Fundamentals of HTML and CSS
F28WP Web Programming
2020-2021
## Overview * Review * Fundamental **HTML** and **CSS** concepts? * Review HTML and CSS **Syntax** * Dynamic vs Static Websites * **Examples** * Questions and Discussion
## Revision Question What does IP Stand for? * Internet Programming * Internet Protocol * Internal Package * Internal Protocol
## Answer IP = Internet Protocol
## Revision Question What does TCP Stand for? * Transfer Cache Practice * Transmission Control Protocol * Transmission Cache Protocol * Test Cache Program
## Answer TCP = Transmission Control Protocol
## Revision Question UDP (User Datagram Protocol) is a communications protocol that is primarily used for establishing low-latency and loss-tolerating connections between applications on the internet. * (a) True * (b) False
## Answer * (a) True
## What is the difference between **Static** and **Dynamic** Web Pages?
## Static Web Pages **Static** website pages are self-contained individual pages (or pages) sent to the browser from the server one-page-at-a-time
## Dynamic Web Pages **Dynamic** web content is built when the page is requested (by the user directly or programmatically while the user is on the page, e.g., Facebook updates) ![](./images/lec02-02.png)
## **How** do we structure content, presentation and behaviour? * What are the **layers/structure** of web design?
## Fundamentals of a Web Page
## HTML ![](./images/html01.png)
## Hyper Text ## + ## Markup Language
## Markup Language * Set of **tags** * Purpose is to group and describe **content** ```
Content
```
## Can you list the essential HTML Tags?
## Tag **Attributes** * Additional information about the tag element ``` ``` * Tag element format > name="value"
## Revision Question Are attribute values case-sensitive? * Yes * No
## Answer Are **attribute** values case-sensitive? * Yes
## Revision Question Basic syntax for HTML tags and attributes is: * a. ```
``` * b. ```
``` * c. ```
``` * d. ```
```
## Answer Basic syntax for HTML tags and attributes is: * d. ```
```
## Revision Question Choose the correct HTML tag for the largest heading * a. `````` * b. ```
``` * c. ```
``` * d. ```
```
## Answer Choose the correct HTML tag for the largest heading * d. ```
```
## Revision Question What is the correct HTML tag for inserting a line break? * a. ```
``` * b. ```
``` * c. ```
```
## Answer What is the correct HTML tag for inserting a line break? * c. ```
```
## CSS ![](./images/cssa.jpg)
## Cascade ## + ## Style Sheet
## Stylesheet * Rules defining **presentation** * Targeted to specific **elements/tags** in the html
## Cascade * Manages priorities and conflicts * Multiple CSS rules * Importances and **inheritance**
## inheritance * Elements inherit style properties ![](./images/css01.png)
## Inheritance
Example
## CSS Syntax * Great Control * Override * Specific
## CSS Control * Three terms for describing style: >1. CSS Rules 2. CSS Selectors 3. CSS Declaration
## CSS Rule ``` selector { property : value; } ``` --- * property:value is known as the **declaration** * Every style has a **selector** and **declaration** * property/value pair called a CSS Rule
## CSS Selector ``` body { font-family: Arial; } p {color: #112233; } a {color: red; } ``` --- * **selector** associates **css rules** with html elements
## CSS Syntax * CSS consists of a **selector** and a **declaration block**: The selector points to the **HTML element** you want to style * **declaration block** contains one or **more** declarations separated by semicolons. * Each declaration includes a CSS property **name and a value**, separated by a colon
## CSS Selectors * ``` Type (tag/element) ``` * ``` # ID ``` * ``` . Class ```
## **Type** (element) Selectors ``` body {declaration} p {delcaration} h1 {delcaration} ``` * Simplest selector * Targets html elements by name
## **ID** Selectors CSS ``` #logo {declaration} ``` HTML ```
``` * ID is an **attribute** added to the html * Reference ID in the CSS with a **hash**
## **Class** Selectors CSS ``` .cat {declaration} ``` HTML ```
``` * class is a html **attribute** added to the markup language * referenced in the css with a **period**
## Which is better? ID or Class?
ID vs Class
• Can only be
one ID
•
Multiple classes
• ID is more specific
• Element can have both ID and multiple classes
## Revision Question Which style is this? ``` ``` * a. Inline style * b. External style sheet * c. External style stylist sheet * d. None of the above
## Answer Which style is this? ``` ``` * a. Inline style
## Question The _______ property is used to set the color of the text. * a. pallet * b. color * c. text-decoration * d. design
## Answer The _______ property is used to set the color of the text. * b. color
## Question What does the following html/css code do? ```html ``` tag
## Question What does the following HTML/CSS do? ```
Hello Hello
What is happening here?
```
## Answer Blue `Hello Hello' * Associated with a **valid** selector ID
How do you validate your HTML and CSS?
## How do you validate your HTML and CSS? * https://validator.w3.org * http://jigsaw.w3.org/css-validator/ * https://validator.w3.org/checklink
## Summary * Understand **fundamental** HTML and CSS concepts * Essential **syntax** * Layers/management (HTML, CSS and JavaScript) * Review (small taste)
## To do this week ... * **Read** over the lectures * **Review** the revision questions * Work through tutorial practicals * Challenging – so start early * **Experiment** (get into good habits)