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

Similar documents
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

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

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

CITS3403 Agile Web Development 2019 Semester 1

Fundamentals of Web Programming a

Appendix D CSS Properties and Values

ID1354 Internet Applications

CITS3403 Agile Web Development 2018, Semester 1

CSS: The Basics CISC 282 September 20, 2014

COSC 2206 Internet Tools. CSS Cascading Style Sheets

Introduction to Web Tech and Programming

Reading 2.2 Cascading Style Sheets

Cascade Stylesheets (CSS)

CSS for Styling CS380

Introduction to Web Design CSS Reference

Introduction to Web Design CSS Reference

CSC 443: Web Programming

CMPT 165 INTRODUCTION TO THE INTERNET AND THE WORLD WIDE WEB

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

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

Controlling Appearance the Old Way

escuela técnica superior de ingeniería informática

Cascading Style Sheets. Overview and Basic use of CSS

Cascading Style Sheet Quick Reference

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

CSS. Lecture 16 COMPSCI 111/111G SS 2018

CSS Lecture 16 COMPSCI 111/111G SS 2018

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

ITNP43: HTML Lecture 4

CSS Styles Quick Reference Guide

Admin. Midterm 1 on. Oct. 13 th (2 weeks from today) Coursework:

CSc 337 LECTURE 3: CSS

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

INTERNATIONAL UNIVERSITY OF JAPAN Public Management and Policy Analysis Program Graduate School of International Relations

CASCADING STYLESHEETS

CSS.

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

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

8a. Cascading Style Sheet


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

HTML/XML. HTML Continued Introduction to CSS

CSE 154 LECTURE 3: MORE CSS

**Method 3** By attaching a style sheet to your web page, and then placing all your styles in that new style sheet.

Tutorial 3: Working with Cascading Style Sheets

Introduction to Multimedia. MMP100 Spring 2016 thiserichagan.com/mmp100

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

CSS Tutorial Part 1: Introduction: A. Adding Style to a Web Page (3 options):

Zen Garden. CSS Zen Garden

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

Chapter 3 Style Sheets: CSS

CSS Cascading Style Sheets

Introduction to CSS. Fijihosting.com Introduction to CSS page 1. What are style sheets? Lovely! How do I use them?

Outline. Link HTML With Style Sheets &6&7XWRULDO &66 ;+70/ (GZDUG;LD

Web Development & Design Foundations with HTML5

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

HTML-5.com itemscopehttp://data-vocabulary.org/breadcrumb<span itemprop="title">html 5</span> itemscopehttp://data-vocabulary.

UNIT-II. XHTML-2 and CSS 2.7 LIST

Web Development & Design Foundations with HTML5

Introduction to Cascading Style Sheets

CSS: Formatting Text. CSS for text processing: font-family. Robert A. Fulkerson

Web Site Design and Development Lecture 6

CSS Cascading Style Sheets

CMPT 165: More CSS Basics

1. Lists. 1.1 Unordered Lists. Subject Code 10CS73. Unit 2 XHTML 2, CSS. Subject Programming the Web

Cascading Style Sheets (CSS)

CSS Selectors. element selectors. .class selectors. #id selectors

By Ryan Stevenson. Guidebook #3 CSS

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

2005 WebGUI Users Conference

Creating A Website - Part 1: Web Design principles, HTML & CSS. CSS Color Values. Hexadecimal Colors. RGB Color

Salvedicta. - Hans Selye CSC 210

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

BIM222 Internet Programming

1 of 7 11/12/2009 9:29 AM

This tutorial will help both students as well as professionals who want to make their websites or personal blogs more attractive.

Html basics Course Outline

CSS. Text & Font Properties. Copyright DevelopIntelligence LLC

Adding CSS to your HTML

ITNP43: HTML Lecture 5

CS105 Course Reader Appendix A: HTML Reference

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

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

recall: a Web page is a text document that contains additional formatting information in the HyperText Markup Language (HTML)

HTML TUTORIAL ONE. Understanding What XHTML is Not

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

Downloads: Google Chrome Browser (Free) - Adobe Brackets (Free) -

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

Module 2 (VII): CSS [Part 4]

CSC 121 Computers and Scientific Thinking

CASCADING STYLE SHEETS (CSS) BY: RIHAM ALSMARI, PNU. Lab 4

Introduction to WEB PROGRAMMING

Web Design and Development Tutorial 03

Introducing Cascading Style Sheets. Cascading Style Sheet Basics Creating Styles Using Styles Manipulating Styles Text Formatting with CSS

Networks and Web for Health Informatics (HINF 6220) Tutorial 8 : CSS. 8 Oct 2015

Chapter 2 CSS for Style

This booklet is knowledge of. a web page. of a web page find what you. you want to. SiteSell offers. Introduction

INFORMATICA GENERALE 2014/2015 LINGUAGGI DI MARKUP CSS

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

Transcription:

3.1 Introduction - HTML is primarily concerned with content, rather than style - However, tags have presentation properties, for which browsers have default values - The CSS1 cascading style sheet specification was developed in 1996; followed by CSS2 in 1998 - Provide the means to control and change presentation of HTML documents - Not technically HTML, but can be embedded in HTML documents - One of the most important capabilities of style sheets is that they allow you to impose a standard style on a whole document, or even a whole collection of documents - Style is specified for a tag by the values of its properties - Current browsers do not implement all of CSS2 Chapter 3 2003 by Addison-Wesley, Inc. 1

3.2 Levels of Style Sheets - There are three levels of style sheets - Inline - specified for a specific occurrence of a tag and apply only to that tag - This is fine-grain style, which defeats the purpose of style sheets - uniform style - Document-level style sheets - apply to the whole document in which they appear - External style sheets - can be applied to any number of documents - When more than one style sheet applies to a specific tag in a document, the lowest level style sheet has precedence - In a sense, the browser searches for a style property spec, starting with inline, until it finds one (or there isn t one) - Browsers can ignore style sheets or use their own default values for properties Chapter 3 2003 by Addison-Wesley, Inc. 2

3.2 Levels of Style Sheets (continued) - Inline style sheets appear in the tag itself - Document-level style sheets appear in the head of the document - External style sheets are in separate files, potentially on any server on the Internet - Written as text files with the MIME type text/css - A <link> tag is used to specify that the browser is to fetch and use an external style sheet file <link rel = stylesheet type = "text/css" href = "http://www.wherever.org/termpaper.css"> </link> - External style sheets can be validated http://jigsaw.w3.org/css-validator/ validator-upload.html Chapter 3 2003 by Addison-Wesley, Inc. 3

3.3 Style Specification Formats - Format depends on the level of the style sheet - Inline: - Style sheet appears as the value of the style attribute - General form: style = "property_1: value_1; property_2: value_2; property_n: value_n - Scope of an inline style sheet is the content of the tag - Document-level: - Style sheet appears as a list of rules that are the content of a <style> tag - The <style> tag must include the type attribute, set to "text/css" - The list of rules must be placed in an HTML comment, because it is not HTML - Comments in the rule list must have a different form - use C comments (/* */) Chapter 3 2003 by Addison-Wesley, Inc. 4

3.3 Style Specification Formats (continued) - General form: <style type = "text/css"> <!-- rule list --> </style> - Form of the rules: selector {list of property/values} - The selector is a tag name or a list of tag names, separated by commas - Examples: h1, h3 p - Each property/value pair has the form: property: value - Pairs are separated by semicolons, just as in the value of a <style> tag - External style sheets - Form is a list of style rules, as in the content of a <style> tag for document-level style sheets Chapter 3 2003 by Addison-Wesley, Inc. 5

3.4 Style Classes - Used to allow different occurrences of the same tag to use different style specifications - A style class has a name, which is attached to a tag name - For example, p.narrow {property/value list} p.wide {property/value list} - The class you want on a particular occurrence of a tag is specified with the class attribute of the tag - For example, <p class = "narrow">... </p>... <p class = "wide">... </p> Chapter 3 2003 by Addison-Wesley, Inc. 6

3.4 Style Classes (continued) - A generic class can be defined if you want a style to apply to more than one kind of tag - A generic class must be named, and the name must begin with a period - Example,.really-big { } - Use it as if it were a normal style class <h1 class = "really-big"> </h1>... <p class = "really-big"> </p> Chapter 3 2003 by Addison-Wesley, Inc. 7

3.5 Properties & Property Values - There are 56 different properties in 6 categories: - Fonts - Colors and backgrounds - Text - Boxes and layouts - Lists - Tags - Property Value Forms - Keywords - left, small, - Not case sensitive - Length - numbers, maybe with decimal points - Units: px - pixels in - inches cm - centimeters mm - millimeters pt - points pc - picas (12 points) em - height of the letter m x-height - height of the letter x - No space is allowed between the number and the unit specification e.g., 1.5 in is illegal! Chapter 3 2003 by Addison-Wesley, Inc. 8

3.5 Properties & Property Values (continued) - Percentage - just a number followed immediately by a percent sign - URL values - url(protocol://server/pathname) - Colors - Color name - rgb(n1, n2, n3) - Numbers can be decimal or percentages - Hex form: #XXXXXX - Property values are inherited by all nested tags, unless overriden - Font Properties - font-family - Value is a list of font names - browser uses the first in the list it has - font-family: Arial, Helvetica, Courier - Generic fonts: serif, sans-serif, cursive, fantasy, and monospace (defined in CSS) - Browser has a specific font for each Chapter 3 2003 by Addison-Wesley, Inc. 9

3.5 Properties & Property Values (continued) - If a font name has more than one word, it should be single-quoted - font-size - Possible values: a length number or a name, such as smaller, xx-large, etc. - font-style - italic, oblique (useless), normal - font-weight - degrees of boldness - bolder, lighter, bold, normal - font - Could specify as a multiple of 100 (100 900) - For specifying a list of font properties font: bolder 14pt Arial Helvetica - Order must be: style, weight, size, name(s) Chapter 3 2003 by Addison-Wesley, Inc. 10

3.5 Properties & Property Values (continued) - Example fonts.html) <html> <head> <title> Font Properties </TITLE> <style type = "text/css"> <!-- /* Document-level style sheet*/ p.big {font-size: 14pt; font-style: italic; font-family: 'Times New Roman'; } p.small {font-size: 10pt; font-weight: bold; font-family: 'Courier New'; } --> </style> </head> <body> <p class = "big"> If a job is worth doing, it s worth doing right. </p> <p class = "small"> Two wrongs don't make a right, but they certainly can get you in a lot of trouble. </p> <h2 style = "font-family: 'Times New Roman'; font-size: 24pt; font-weight: bold"> Chapter 1 Introduction </h2> <h3 style = "font-family: 'Courier New'; font-size: 18pt"> 1.1 The Basics of Computer Networks </h3> </body> </html> Chapter 3 2003 by Addison-Wesley, Inc. 11

3.5 Properties & Property Values (continued) - The text-decoration property - line-through, overline, underline, none - List properties - list-style-type - Unordered lists - Bullet can be a disc (default), a square, or a circle - Set it on either the <ul> or <li> tag - On <ul>, it applies to list items <h3> Some Common Single-Engine Aircraft </h3> <ul style = "list-style-type: square"> <li> Cessna Skyhawk </li> <li> Beechcraft Bonanza </li> <li> Piper Cherokee </li> </ul> Chapter 3 2003 by Addison-Wesley, Inc. 12

3.5 Properties & Property Values (continued) - On <li>, list-style-type applies to just that item <h3> Some Common Single-Engine Aircraft </h3> <ul> <li style = "list-style-type: disc"> Cessna Skyhawk </li> <li style = "list-style-type: square"> Beechcraft Bonanza </li> <li style = "list-style-type: circle"> Piper Cherokee </li> </ul> Chapter 3 2003 by Addison-Wesley, Inc. 13

3.5 Properties & Property Values (continued) - Could use an image for the bullets in an unordered list - Example: <li style = "list-style-image: url(bird.jpg)"> - On ordered lists - list-style-type can be used to change the sequence values Property value Sequence type First four decimal Arabic numerals 1, 2, 3, 4 upper-alpha Uc letters A, B, C, D lower-alpha Lc letters a, b, c, d upper-roman Uc Roman I, II, III, IV lower-roman Lc Roman i, ii, iii, iv Chapter 3 2003 by Addison-Wesley, Inc. 14

3.5 Properties & Property Values (continued) <h3> Aircraft Types </h3> <ol style = "list-style-type: upper-roman"> <li> General Aviation (piston-driven engines) </li> <ol style = "list-style-type: upper-alpha"> <li> Single-Engine Aircraft </li> <ol style = "list-style-type: decimal"> <li> Tail wheel </li> <li> Tricycle </li> </ol> <br /> <li> Dual-Engine Aircraft </li> <ol style = "list-style-type: decimal"> <li> Wing-mounted engines </li> <li> Push-pull fuselage-mounted engines </li> </ol> </ol> <br /> <li> Commercial Aviation (jet engines) </li> <ol style = "list-style-type: upper-alpha"> <li> Dual-Engine </li> <ol style = "list-style-type: decimal"> <li> Wing-mounted engines </li> <li> Fuselage-mounted engines </li> </ol> <br /> <li> Tri-Engine </li> <ol style = "list-style-type: decimal"> <li> Third engine in vertical stabilizer </li> <li> Third engine in fuselage </li> </ol> </ol> </ol> Chapter 3 2003 by Addison-Wesley, Inc. 15

3.5 Properties & Property Values (continued) Chapter 3 2003 by Addison-Wesley, Inc. 16

3.5 Properties & Property Values (continued) - Alignment of text - The text-indent property allows indentation - Takes either a length or a % value - The text-align property has the possible values, left (the default), center, right, or justify - Sometimes we want text to flow around another element - the float property - The float property has the possible values, left, right, and none (the default) - If we have an element we want on the right, with text flowing on its left, we use the default text-align value (left) for the text and the right value for float on the element we want on the right Chapter 3 2003 by Addison-Wesley, Inc. 17

3.5 Properties & Property Values (continued) <img src = "c210.jpg" style = "float: right" /> -- Some text with the default alignment - left Chapter 3 2003 by Addison-Wesley, Inc. 18

3.5 Properties & Property Values (continued) - Margins - The margins around an HTML object can be set with margin-left, etc. - just assign them a length value <img src = "c210.jpg " style = "float: right; margin-left: 0.5in; margin-bottom: 0.5in" /> Chapter 3 2003 by Addison-Wesley, Inc. 19

3.6 Colors - Color is a problem for the Web for two reasons: 1. Monitors vary widely 2. Browsers vary widely - There are three color collections 1. There is a set of 16 colors that are guaranteed to be displayable by all graphical browsers on all color monitors black 000000 green 008000 silver C0C0C0 lime 00FF00 gray 808080 olive 808000 white FFFFFF yellow FFFF00 maroon 800000 navy 000080 red FF0000 blue 0000FF purple 800080 teal 008080 fuchia FF00FF aqua 00FFFF 2. There is a much larger set, the Web Palette - 216 colors - Use hex color values of 00, 33, 66, 99, CC, and FF - Inside back cover of this book has them! Chapter 3 2003 by Addison-Wesley, Inc. 20

3.6 Colors (continued) 3. Any one of 16 million different colors - The color property specifies the foreground color of elements <table border = "5px"> <tr> <th style = "color: red"> Apple </th> <th style = "color: orange"> Orange </th> <th style = "color: orange"> Screwdriver </th> </tr> </table> - The background-color property specifies the background color of elements <p style = "font-size: 24; color: blue; background-color: red"> To really make it stand out, use a red background! </p> - The background-image property - Use with care Chapter 3 2003 by Addison-Wesley, Inc. 21

3.7 The <span> and <div> tags - One problem with the font properties is that they apply to whole elements, which are often too large - Solution: a new tag to define an element in the content of a larger element - <span> - The default meaning of <span> is to leave the content as it is - e.g., <p> Now is the <span> best time </span> ever! </p> - Use <span> to apply an inline style sheet to its content <p> Now is the <span style = "font-size: 40; font-family: Ariel; color: red"> best time </span> ever! </p> Chapter 3 2003 by Addison-Wesley, Inc. 22

3.7 The <span> and <div> tags (continued) - The <span> tag is similar to other HTML tags, they can be nested and they have id and class attributes - Another tag that is useful for style specifications: <div> - Used to create document sections (or divisions) for which style can be specified - e.g., A section of five paragraphs for which you want some particular style Chapter 3 2003 by Addison-Wesley, Inc. 23

Box Model in CSS http://www.w3.org/tr/rec-css2/box.html Chapter 3 2003 by Addison-Wesley, Inc. 24

Media Types A CSS media type names a set of CSS properties. A user agent that claims to support a media type by name must implement all of the properties that apply to that media type. The different media types are all aural braille embossed handheld print projection screen tty tv Chapter 3 2003 by Addison-Wesley, Inc. 25