ITNP43: HTML Lecture 4



Similar documents
What is CSS? Official W3C standard for controlling presentation Style sheets rely on underlying markup structure

Outline of CSS: Cascading Style Sheets

Web Design Basics. Cindy Royal, Ph.D. Associate Professor Texas State University

Web Design Revision. AQA AS-Level Computing COMP2. 39 minutes. 39 marks. Page 1 of 17

Web Design and Databases WD: Class 7: HTML and CSS Part 3

Web Building Blocks. Joseph Gilbert User Experience Web Developer University of Virginia Library

{color:blue; font-size: 12px;}

Web Design with CSS and CSS3. Dr. Jan Stelovsky

Basics of HTML (some repetition) Cascading Style Sheets (some repetition) Web Design

Web Development CSE2WD Final Examination June (a) Which organisation is primarily responsible for HTML, CSS and DOM standards?

HTML5 and CSS3 Design with CSS Page 1

CIS 467/602-01: Data Visualization

CSS 101. CSS CODE The code in a style sheet is made up of rules of the following types

Web Design and Development ACS Chapter 9. Page Structure

Web Design for Print Designers WEB DESIGN FOR PRINT DESIGNERS: WEEK 6

Cascading Style Sheets (CSS)

Last week we talked about creating your own tags: div tags and span tags. A div tag goes around other tags, e.g.,:

CSS. CSS - cascading style sheets CSS - permite separar num documento HTML o conteúdo do estilo. ADI css 1/28

Web Authoring CSS. Module Descriptor

Creating a Resume Webpage with

Web Development 1 A4 Project Description Web Architecture

Introduction to Adobe Dreamweaver CC

HTML TIPS FOR DESIGNING

CST 150 Web Design I CSS Review - In-Class Lab

HTML CSS Basic Structure. HTML Structure [Source Code] CSS Structure [Cascading Styles] DIV or ID Tags and Classes. The BOX MODEL

Create Webpages using HTML and CSS

Dreamweaver CS4 Day 2 Creating a Website using Div Tags, CSS, and Templates

COMP519 Web Programming Autumn Cascading Style Sheets

ICE: HTML, CSS, and Validation

CSS - Cascading Style Sheets

Essential HTML & CSS for WordPress. Mark Raymond Luminys, Inc mraymond@luminys.com

Cascading Style Sheet (CSS) Tutorial Using Notepad. Step by step instructions with full color screen shots

WEB DESIGN LAB PART- A HTML LABORATORY MANUAL FOR 3 RD SEM IS AND CS ( )

Selectors in Action LESSON 3

Using Style Sheets for Consistency

How to Properly Compose HTML Code : 1

ART 379 Web Design. HTML, XHTML & CSS: Introduction, 1-2

Advanced Web Design. Zac Van Note.

Contents. Downloading the Data Files Centering Page Elements... 6

Style & Layout in the web: CSS and Bootstrap

How to code, test, and validate a web page

HTML, CSS, XML, and XSL

Website Development. 2 Text. 2.1 Fonts. Terry Marris September We see how to format text and separate structure from content.

CREATING A NEWSLETTER IN ADOBE DREAMWEAVER CS5 (step-by-step directions)

CHAPTER 10. When you complete this chapter, you will be able to:

Designing HTML s for Use in the Advanced Editor

Using an external style sheet with Dreamweaver (CS6)

GUIDE TO CODE KILLER RESPONSIVE S

EUROPEAN COMPUTER DRIVING LICENCE / INTERNATIONAL COMPUTER DRIVING LICENCE WEB EDITING

How To Create A Web Page On A Windows (For Free) With A Notepad) On A Macintosh (For A Freebie) Or Macintosh Web Browser (For Cheap) On Your Computer Or Macbook (

HTML and CSS. Elliot Davies. April 10th,

Website Planning Checklist

A send-a-friend application with ASP Smart Mailer

Simply download Beepip from and run the file when it arrives at your computer.

Cascading Style Sheets

Create Your own Company s Design Theme

Mobile Web Site Style Guide

Advanced Editor User s Guide

Chapter 2 HTML Basics Key Concepts. Copyright 2013 Terry Ann Morris, Ed.D

JJY s Joomla 1.5 Template Design Tutorial:

ICT 6012: Web Programming

MCH Strategic Data Best Practices Review

Interactive Data Visualization for the Web Scott Murray

Table of Contents THE DESIGNER S GUIDE TO CREATING NEWZAPP DRAG AND DROP TEMPLATES... 6 THE NEWZAPP SYSTEM... 7

Creating HTML authored webpages using a text editor

Creating Web Pages with Dreamweaver CS 6 and CSS

BASICS OF WEB DESIGN CHAPTER 2 HTML BASICS KEY CONCEPTS COPYRIGHT 2013 TERRY ANN MORRIS, ED.D

Responsive Web Design: Media Types/Media Queries/Fluid Images

Web Design I. Spring 2009 Kevin Cole Gallaudet University

HTML5 and CSS3 Part 1: Using HTML and CSS to Create a Website Layout

Web Development. Owen Sacco. ICS2205/ICS2230 Web Intelligence

CST 150 Web Design and Development I Midterm Exam Study Questions Chapters 1-3

WordPress and HTML Basics

Further web design: Cascading Style Sheets Practical workbook

Responsive Design

BlueHornet Whitepaper

Chapter 8 More on Links, Layout, and Mobile Key Concepts. Copyright 2013 Terry Ann Morris, Ed.D

How to Create an HTML Page

Chapter 7 Page Layout Basics Key Concepts. Copyright 2013 Terry Ann Morris, Ed.D

Embedding a Data View dynamic report into an existing web-page

Development Perspective: DIV and CSS HTML layout. Web Design. Lesson 2. Development Perspective: DIV/CSS

Garfield Public Schools Fine & Practical Arts Curriculum Web Design

Tips and tricks with Text boxes in Mahara

Programming the Web 06CS73 SAMPLE QUESTIONS

Base template development guide

CREATING HORIZONTAL NAVIGATION BAR USING ADOBE DREAMWEAVER CS5

mpdf Example 37. Barcodes <?php

Transcription:

ITNP43: HTML Lecture 4 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 1

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 <em>wonderful</em> 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 > (deprecated) 4 2

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 3

CSS Zen Garden Example See www.csszengarden.com for an exercise in CSS styling. 7 Style Rules Style rules consist of: selector { property p : 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 4

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 t { color: red; } <h1 class= important >Attention!</h1> <p class= important >Red text.</p> 10 5

ID Selectors ID selectors are used to specify a style for a particular identified element id example: h1 { color: green; } h1#myhead21 { color: red; } <h1 id= myhead21 >Attention!</h1> Do not really need the element e.g.: #myhead21 { color: red; } 11 Inline styles Adding Styles to HTML style information for individual HTML elements in the HTML document itself styleattribute e.g. <h1 style= color: red >Red Head</h1> Embedded style sheets in HTML <head> External style sheets in a separate file 12 6

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> 13 Embedded Style Sheets <style type= text/css > in header Or in HTML5, just <style> <head> <style> h1 { color: red; } p { font-size: 24pt; font-family: Verdana, sans-serif; } </style> <title>examples of CSS</title> </head> 14 7

External Style Sheets Put all style information in a separate file (e.g. mystyles.css) Just your style rules (no need for the <style> tag) 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... 15 Linking Style Sheets <link> tag in HTML header <head> <link rel= stylesheet href= mypath/mystyles.css /> </head> relattribute 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 16 8

The Cascade More than one style sheet can affect a single document at one time A hierarchy is defined: GENERAL 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 SPECIFIC The specific overrides the general 17 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 18 9

Colour Specification By name: 140 named colours in CSS 3 (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; } 19 Font family: Font Properties Usually specify specific and generic fonts e.g. { font-family: family: Arial, Verdana, sans-serif; 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; } 20 10

<html> <head> <title>examples of CSS</title> <link rel="stylesheet" type="text/css" href="mystyles.css > <style type="text/css"> h1 { color: green; } h2 { color: maroon; } p { font-size: 18pt; font-family: Arial, sans-serif; } em { background-color: #8000ff; color: white; } li em { background-color: white; color: red; font-weight: bold; } </style> </head> 21 <body> <p class="border">this gives you a basic idea of how to use style sheets and how they "cascade". There are a great many elements of style that can be specified with style sheets. Niederst's Web Design in a Nutshell mystyles.css is a good place to start to learn more about h1 { color: red; } what you can do.</p> p { font-size: 24pt; </body> font-family: Verdana, sans-serif; </html> color: blue; } p.border { color: white; background-color: navy; border-width: medium; border-style: inset; } 22 11

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; } 23 24 12

List Styles Bullets and numbering in lists are set with styles: e.g. ul { list-style-type: square; } eg e.g. ol { list-style-type: style type: upper-alpha; } 25 CSS Information W3C home page for CSS www.w3.org/style/css/ Validation: CSS validation at jigsaw.w3.org/css-validator/ can upload external style sheets or cut-and-paste style rules from embedded sheets Tutorials http://www.w3schools.com/css/ w3schools com/css/ Predefined style sheets www.csszengarden.com 26 13

End of Lecture Next lecture: more CSS 27 14