ITNP43: HTML Lecture 4

Similar documents
CSS: The Basics CISC 282 September 20, 2014

INTRODUCTION TO CSS. Mohammad Jawad Kadhim

3.1 Introduction. 3.2 Levels of Style Sheets. - HTML is primarily concerned with content, rather than style. - There are three levels of style sheets

- HTML is primarily concerned with content, rather than style. - However, tags have presentation properties, for which browsers have default values

CSS is applied to an existing HTML web document--both working in tandem to display web pages.

3.1 Introduction. 3.2 Levels of Style Sheets. - The CSS1 specification was developed in There are three levels of style sheets

- The CSS1 specification was developed in CSS2 was released in CSS2.1 reflects browser implementations

Cascading Style Sheets. Overview and Basic use of CSS

- The CSS1 specification was developed in CSSs provide the means to control and change presentation of HTML documents

Appendix D CSS Properties and Values

CSS. Lecture 16 COMPSCI 111/111G SS 2018

CSS Cascading Style Sheets

CSS: Cascading Style Sheets

CSS Lecture 16 COMPSCI 111/111G SS 2018

2. Write style rules for how you d like certain elements to look.

Data Visualization (CIS/DSC 468)

Cascading Style Sheets (CSS)

Review Question 1. Which tag is used to create a link to another page? 1. <p> 2. <li> 3. <a> 4. <em>

Web Design and Development Tutorial 03

Introduction to WEB PROGRAMMING

CSS.

Study Guide 2 - HTML and CSS - Chap. 6,8,10,11,12 Name - Alexia Bernardo

COSC 2206 Internet Tools. CSS Cascading Style Sheets

Html basics Course Outline

To link to an external stylesheet, the link element is placed within the head of the html page:

8/19/2018. Web Development & Design Foundations with HTML5. Learning Objectives (1 of 2) Learning Objectives (2 of 2)

ID1354 Internet Applications

COMS 359: Interactive Media

Web Development & Design Foundations with HTML5

Web Design and Development ACS-1809

Welcome Please sit on alternating rows. powered by lucid & no.dots.nl/student

CSS: formatting webpages

Make a Website. A complex guide to building a website through continuing the fundamentals of HTML & CSS. Created by Michael Parekh 1

WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5

<style type="text/css"> <!-- body {font-family: Verdana, Arial, sans-serif} ***set font family for entire Web page***

Zen Garden. CSS Zen Garden

Indian Institute of Technology Kharagpur. HTML Part III. Prof. Indranil Sen Gupta Dept. of Computer Science & Engg. I.I.T.

Data Visualization (DSC 530/CIS )

ADDING CSS TO YOUR HTML DOCUMENT. A FEW CSS VALUES (colour, size and the box model)

CSE 154 LECTURE 3: MORE CSS

CSS: Cascading Style Sheets

EECS1012. Net-centric Introduction to Computing. Lecture 3: CSS for Styling

HTML/CSS. HTML review and extra CSS review CSS Color

Session 4. Style Sheets (CSS) Reading & References. A reference containing tables of CSS properties

HTML & CSS. SWE 432, Fall 2017 Design and Implementation of Software for the Web

Web Engineering CSS. By Assistant Prof Malik M Ali

Index. alt, 38, 57 class, 86, 88, 101, 107 href, 24, 51, 57 id, 86 88, 98 overview, 37. src, 37, 57. backend, WordPress, 146, 148

Unit 10 - Client Side Customisation of Web Pages. Week 5 Lesson 1 CSS - Selectors

The internet is a worldwide collection of networks that link millions of computers. These links allow the computers to share and send data.

Session 3.1 Objectives Review the history and concepts of CSS Explore inline styles, embedded styles, and external style sheets Understand style

CSS مفاهیم ساختار و اصول استفاده و به کارگیری

CSS Cascading Style Sheets

Text and Layout. Digital Multimedia, 2nd edition Nigel Chapman & Jenny Chapman Chapter 11. This presentation 2004, MacAvon Media Productions

CSS for Styling CS380

Chapter 3 Style Sheets: CSS

Introduction to Web Tech and Programming

CMPT 165 INTRODUCTION TO THE INTERNET AND THE WORLD WIDE WEB

Markup Language SGML: Standard Generalized Markup Language. HyperText Markup Language (HTML) extensible Markup Language (XML) TeX LaTeX

Web Development & Design Foundations with HTML5

Cascading Style Sheets Level 2

Controlling Appearance the Old Way

Web Information System Design No.4 Put Style to Web Documents. Tatsuya Hagino

CITS3403 Agile Web Development 2019 Semester 1

HTML Summary. All of the following are containers. Structure. Italics Bold. Line Break. Horizontal Rule. Non-break (hard) space.

Learning Objectives. Review html Learn to write a basic webpage in html Understand what the basic building blocks of html are

Data Visualization (DSC 530/CIS )

<body bgcolor=" " fgcolor=" " link=" " vlink=" " alink=" "> These body attributes have now been deprecated, and should not be used in XHTML.

Three Ways to Use CSS:

Overview. Part I: Portraying the Internet as a collection of online information systems HTML/XHTML & CSS

Web Development & Design Foundations with HTML5, 8 th Edition Instructor Materials Chapter 3 Test Bank

.hedgehog { background-image: url(backyard.jpg); color: #ffff99; height: 6in; width: 12in; } .tube {

CHAPTER 4 CASCADING STYLE SHEETS BASICS KEY CONCEPTS

Styles, Style Sheets, the Box Model and Liquid Layout

Cascading Style Sheet. Styles as Tag Attributes. Syntax. <h1>: what font type/size is used? STYLE = SELECTOR {RULES} Attributes such as bgcolor

Chapter 7 Typography, Style Sheets, and Color. Mrs. Johnson

HTML/XML. HTML Continued Introduction to CSS

GIMP WEB 2.0 MENUS. Web 2.0 Menus: Horizontal Navigation Bar with Dynamic Background Image

CSc 337 LECTURE 3: CSS

Reading 2.2 Cascading Style Sheets

CSS. Shan-Hung Wu CS, NTHU

The building block of a CSS stylesheet. A rule consists of a selector and a declaration block (one or more declarations).

ICT IGCSE Practical Revision Presentation Web Authoring

ACSC 231 Internet Technologies

CSC 443: Web Programming

Fundamentals of Web Programming a

The Benefits of CSS. Less work: Change look of the whole site with one edit

Module 2 (VII): CSS [Part 4]

Web Programming and Design. MPT Senior Cycle Tutor: Tamara Week 2

Chapter 12: FORMATTING TEXT

8a. Cascading Style Sheet

Tutorial 3: Working with Cascading Style Sheets

Cascade Stylesheets (CSS)

Lab Introduction to Cascading Style Sheets

IDM 221. Web Design I. IDM 221: Web Authoring I 1

HTML & CSS November 19, 2014

Unit 20 - Client Side Customisation of Web Pages. Week 2 Lesson 3 Introduction to CSS

Creating and Building Websites

CSCB20 Week 7. Introduction to Database and Web Application Programming. Anna Bretscher Winter 2017

Web Structure and Style. MB2030 Section 2 Class 4

HTML + CSS. ScottyLabs WDW. Overview HTML Tags CSS Properties Resources

Transcription:

ITNP43: HTML Lecture 4 Niederst, Part III (3rd edn) 1

Style versus Content HTML purists insist that style should be separate from content and structure HTML was only designed to specify the structure and content of a document Style (how things look) is left up to software that displays HTML documents - web browsers 2

Structure and Content Structure headings paragraphs lists tables Content text images <html> <head> <title>my First Web Page</title> </head> <body> <p> Hello world. </p> <p> It is a <i>wonderful</i> day, today! </p> </body> </html> 3

Style and HTML But web page designers wish to have control over how things look Fonts, colours Page layout So HTML does include tags and attributes to specify some aspects of style <i>, <b>, <font color= #336699 > 4

Style Sheets We might wish to specify style separately from content and structure in a style sheet give page designer full control over style A style sheet specifies the style of page elements e.g. I want all my headings in red One style sheet may serve for many different pages 5

Cascading Style Sheets (CSS) HTML style sheets are known as cascading style sheets Reasonable support by latest browsers Revision CSS 2.1 widely used. (Parts of) CSS 3 implemented Cascade refers to the fact that a hierarchy of style information may be specified (details later) Style information may be in the HTML file itself or in a separate file Style sheets consist of rules for specifying how page elements should be displayed 6

CSS Zen Garden Example See www.csszengarden.com for an exercise in CSS styling. 7

Style rules consist of: Style Rules selector { property : value } declaration Selector identifies element(s) to be affected e.g. h1, p Declaration specifies particular style instructions for the element e.g. colour, font 8

Contextual Selectors Style attributes can be specified according to their context, e.g. we may specify that emphasized text should be red: em { color: red; } an overriding rule can specify that any emphasized text in a list item should be green: li em { color: green; } 9

CLASS Selectors class selectors are used to specify different possible styles for single elements class example: h1 { color: green; } h1.important { color: red; } <h1 class= important >Attention!</h1> Can be non-tag specific (note the dot):.important { color: red; } <h1 class= important >Attention!</h1> <p class= important >Red text.</p> 10

Adding Styles to HTML Inline styles style information for individual HTML elements in the HTML document itself style attribute e.g. <h1 style= color: red >Red Head</h1> Embedded style sheets in HTML <head> External style sheets in a separate file 11

Inline Styles with Scope <div> and <span> These are HTML tags for delimiting parts of a document that a style will be applied to <div style= color: blue > <h1>my Heading</h1> <p>just some blue text.</p> </div> <p>just some <span style= color: blue >blue text.</span> This sentence is not blue.</p> 12

Embedded Style Sheets <style type= text/css > in header <head> <style type="text/css"> h1 { color: red; } p { font-size: 24pt; font-family: Verdana, sans-serif; } </style> <title>examples of CSS</title> </head> 13

External Style Sheets Put all style information in a separate file (e.g. mystyles.css) h1 { color: red; } p { font-size: 24pt; font-family: Verdana, sans-serif; } HTML document says which external style sheet document(s) it will use maybe more than one details next... 14

Linking Style Sheets <link> tag in HTML header <head> <link rel= stylesheet href= mypath/mystyles.css type= text/css /> </head> rel attribute defines linked document s relationship with current document e.g. stylesheet Can have more than one link per document Can have inline, embedded and linked styles in one document 15

The Cascade More than one style sheet can affect a single document at one time A hierarchy is defined: browser default settings user style settings (set in browser) linked external style sheets, in order listed embedded style sheets later rules have precedence over earlier rules inline styles The specific overrides the general GENERAL SPECIFIC 16

Inheritance This kind of hierarchy applies to HTML tag attributes, as well Style properties are passed down from a parent element to any child element, e.g. colour specifications for text at the <body> level apply to the whole document, except... colour specs for lists are applied to every list item this colour spec would override spec at the body level colour specs could be given for individual list items overriding specs at the list or body levels 17

Colour Specification By name: 16 named colours (17 in CSS 2.1) e.g. h1 { color: olive; } By RGB value a variety of ways: { color: #0080FF; } { color: rgb(0,128,255); } { color: rgb(0%, 50%, 100%); } Background and foreground colours: h1 { background-color: silver; color: olive; } 18

Font Properties Font family: Usually specify specific and generic fonts e.g. { font-family: Arial, Verdana, sans-serif; } Font size: Absolute e.g. p { font-size: small; } or { font-size: 9pt; } Relative e.g. p { font-size: 0.8em; } or { font-size: 80%; } Relative is best for accessibility Differences in how relative sizes are inherited Font weight and style: E.g p { font-weight: bold; font-style: italic; } Niederst, Chapt 18 (3 rd edn) 19

Text Properties Text (and inline element) alignment: Indent first line of text e.g. p { text-indent: 20px; } Horizontal alignment e.g. p { text-align: center; } Vertical alignment e.g. p { vertical-align: sub; } <p>just some text <img style= vertical-align: middle src= myimage.jpg alt= nice picture /> with an image in the middle.</p> Text spacing: Letter spacing e.g. p { letter-spacing: 8px; } Word spacing e.g. p { word-spacing: 1em; } Niederst, Chapt 18 (3 rd edn) 20

21

List Styles Bullets and numbering in lists are set with styles: e.g. ul { list-style-type: square; } e.g. ol { list-style-type: upper-alpha; } Niederst, Chapt 23 (3 rd edn) 22

CSS Information Validation: CSS validation at http://jigsaw.w3.org/css-validator/ can upload external style sheets or cut-and-paste style rules from embedded sheets Tutorials links to tutorials at http://www.w3.org/style/css/learning e.g. http://www.w3.org/markup/guide/style Predefined style sheets http://www.w3.org/stylesheets/core/ 23

Examples 24

End of Lecture Next lecture: more CSS 25