Using Cascading Style Sheets CSS Basics. Goals Understand basic syntax of Cascading Style Sheets (CSS) Understand basic syntax of Cascading Style Sheets.

Slides:



Advertisements
Similar presentations
Copyright © 2003 Pearson Education, Inc. Slide 3-1 Created by Cheryl M. Hughes The Web Wizards Guide to XML by Cheryl M. Hughes.
Advertisements

Introduction to HTML & CSS
XHTML1 Cascading Style Sheets Chapter 8. XHTML2 Objectives In this chapter, you will: Study basic Cascading Style Sheet (CSS) syntax Work with internal.
CSS Cascading Style Sheets. Objectives Using Inline Styles Working with Selectors Using Embedded Styles Using an External Style Sheet Applying a Style.
Cascading Style Sheets
/k/k 1212 Cascading Style Sheets Part one Marko Boon
Cascading Style Sheets: Basics I450 Technology Seminar Copyright 2003, Matt Hottell.
Introducing CSS CIS 133 mashup Javascript, jQuery and XML 1.
Part 3 Introduction to CSS. CSS Text Text Styles h1 {color: green} // rgb(0,255,0), #00ff00 h2{letter-spacing: 0.5cm} // 2px h3 {text-align: right} //
Measurement Many CSS properties (values within the declaration) require that you specify a unit of measurement, such as spacing between elements, border.
© 2010, Robert K. Moniot Chapter 5 CSS : Cascading Style Sheets 1.
Chapter 8 Creating Style Sheets.
XP Introducing Cascading Style Sheets With Cascading Style Sheets (CSS), you can create one or more documents that control the appearance of some or all.
Tutorial 3 Introducing Cascading Style Sheets. XP New Perspectives on Blended HTML, XHTML, and CSS2 Objectives Learn about Cascading Style Sheets Write.
Chapter 6 Web Typography
Week 7 Web Typography. 2 Understanding Type Design Principles.
Outline IS400: Development of Business Applications on the Internet Fall 2004 Instructor: Dr. Boris Jukic CSS: Cascading Style Sheets.
CSS Basics LIS Webteam April 8, Why CSS? What’s wrong with HTML? Structure vs Style Early web design used hacks to style webpages with HTML – like.
Using Cascading Style Sheets CSS Structure. Goals Understand how contextual, class and ID selectors work Understand how contextual, class and ID selectors.
4.01 Cascading Style Sheets
1 Working with Cascading Style Sheet (CSS). 2 Cascading Style Sheets (CSS)  a style defines the appearance of a document element. o E.g., font size,
Working with Cascading Style Sheets. Introducing Cascading Style Sheets Style sheets are files or forms that describe the layout and appearance of a document.
Using Cascading Style Sheets. Introduction to Styles and Properties  Cascading Style Sheets (CSS) are a standard set by the World Wide Web Consortium.
Chapter 11 Cascading Style Sheets: Part I The Web Warrior Guide to Web Design Technologies.
Cascading style sheets (CSS)
Chapter 7 Web Typography Principles of Web Design, 4 th Edition.
Using Styles and Style Sheets for Design
Cascading Style Sheet (CSS)
Chapter 6 Web Typography. 2 Principles of Web Design Chapter 5 Objectives Understand principles for type design on a Web site Use the element Understand.
INTRODUCTION TO HTML5 Styling Text. Change the Font Size  You can use the font-size property to change the font size for a document’s text.  Instead.
Chapter 12 Cascading Style Sheets: Part II The Web Warrior Guide to Web Design Technologies.
Section 4.1 Format HTML tags Identify HTML guidelines Section 4.2 Organize Web site files and folder Use a text editor Use HTML tags and attributes Create.
Introduction To CSS.. HTML Review What is HTML used for? Give some examples of formatting tags in HTML? HTML is the most widely used language on the Web.
 This presentation introduces the following: › 3 types of CSS › CSS syntax › CSS comments › CSS and color › The box model.
 A style sheet is a single page of formatting instructions that can control the appearance of many HTML pages at once.  If style sheets accomplished.
Cascading Style Sheets Objective: Create an external style sheet, embedded style sheet, and an inline style to change the look and feel of a web site.
Cascading Style Sheets CSS. Source W3Schools
Cascading Style Sheets Eugenia Fernandez IUPUI. CSS Purpose CSS allow you to specify the style in which your XML elements are displayed. CSS were originally.
XP Review 2 New Perspectives on JavaScript, Comprehensive1 Introducing Cascading Style Sheets Formatting Web Pages with CSS.
XHTML Formatting font with a style declaration. Formatting Font HTML uses the font tag to change size and family of font But… the font tag is being deprecated.
1 Working with Cascading Style Sheet (CSS). 2 Cascading Style Sheets (CSS)  a style defines the appearance of a document element. o E.g., font size,
CSS Cascading Style Sheets A very brief introduction CSS, Cascading Style Sheets1.
Microsoft Expression Web 3 – Illustrated Unit D: Structuring and Styling Text.
CSS Hadas Kahsay. Overview  What is CSS  Basic syntax of CSS Rules  How to link CSS style to html documents  Browsers and CSS  Advantages of CSS.
Web Technologies Beginning Cascading Style Sheets (CSS) 1Copyright © Texas Education Agency, All rights reserved.
CSS Cascading Style Sheets *referenced from
CSS FOUNDATIONS IN-DEPTH The nitty-gritty of css...
Blended HTML and CSS Fundamentals 3 rd EDITION Tutorial 3 Introducing Cascading Style Sheets.
1 Cascading Style Sheet (CSS). 2 Cascading Style Sheets (CSS)  a style defines the appearance of a document element. o E.g., font size, font color etc…
CSCI N241: Fundamentals of Web Design Copyright ©2004  Department of Computer & Information Science Using Cascading Style Sheets Module A: CSS Basics.
CSS Introductions. Objectives To take control of the appearance of a Web site by creating style sheets. To use a style sheet to give all the pages of.
Internet & World Wide Web How to Program, 5/e 1. 2.
HTML5 and CSS3 Illustrated Unit D: Formatting Text with CSS
Cascading Style Sheets™ (CSS)
4.01 Cascading Style Sheets
CSS: Cascading Style Sheets
Cascading Style Sheets
Chapter 6 Cascading Style Sheets™ (CSS)
Madam Hazwani binti Rahmat
Using Cascading Style Sheets Module B: CSS Structure
Website Design 3
Cascading Style Sheets (Introduction)
Cascading Style Sheets (Introduction)
Cascading Style Sheets™ (CSS)
Tutorial 3 Working with Cascading Style Sheets
Cascading Style Sheets
4.01 Cascading Style Sheets
Cascading Style Sheets III B. Com (Paper - VI) & III B
Cascading Style Sheets™ (CSS)
CGS 3066: Web Programming and Design Fall 2019
Presentation transcript:

Using Cascading Style Sheets CSS Basics

Goals Understand basic syntax of Cascading Style Sheets (CSS) Understand basic syntax of Cascading Style Sheets (CSS) Understand the differences among inline, internal and external style sheets Understand the differences among inline, internal and external style sheets Understand how to declare a style Understand how to declare a style Understand how to attach specify values Understand how to attach specify values

Introduction to Styles and Properties To ensure that future Web page authoring separates the definition of the elements in a document from how they appear, many of the display and formatting extensions that were added to the HTML language, such as the element, were deprecated in HTML 4.0 and in XHTML 1.0 in favor of CSS To ensure that future Web page authoring separates the definition of the elements in a document from how they appear, many of the display and formatting extensions that were added to the HTML language, such as the element, were deprecated in HTML 4.0 and in XHTML 1.0 in favor of CSS

Introduction to Styles and Properties Cascading Style Sheets (CSS) are a standard set by the World Wide Web Consortium (W3C) for managing the design and formatting of Web pages in a Web browser Cascading Style Sheets (CSS) are a standard set by the World Wide Web Consortium (W3C) for managing the design and formatting of Web pages in a Web browser

Introduction to Styles and Properties A single piece of CSS formatting information, such as text alignment or font size, is referred to as a style A single piece of CSS formatting information, such as text alignment or font size, is referred to as a style Some of the style capabilities of CSS include the ability to change fonts, backgrounds, and colors, and to modify the layout of elements as they appear in a Web browser Some of the style capabilities of CSS include the ability to change fonts, backgrounds, and colors, and to modify the layout of elements as they appear in a Web browser

Introduction to Styles and Properties CSS information can be added directly to documents or stored in separate documents and shared among multiple Web pages CSS information can be added directly to documents or stored in separate documents and shared among multiple Web pages The term “cascading” refers to the Web pages’ ability to use CSS information from more than one source The term “cascading” refers to the Web pages’ ability to use CSS information from more than one source

CSS Properties CSS styles are created with two parts separated by a colon: the property, which refers to a specific CSS style, and the value assigned to it, which determines the style’s visual characteristics CSS styles are created with two parts separated by a colon: the property, which refers to a specific CSS style, and the value assigned to it, which determines the style’s visual characteristics Together, a CSS property and the value assigned to it are referred to as a declaration or style declaration Together, a CSS property and the value assigned to it are referred to as a declaration or style declaration

CSS Properties

Common CSS Properties

CSS Properties The properties available in CSS1 are grouped into the following categories: The properties available in CSS1 are grouped into the following categories: Color and background properties Color and background properties Font properties Font properties Text properties Text properties Box properties Box properties Classification properties Classification properties

CSS Properties CSS recommendation, Level 2 (CSS2) was released in 1998 CSS recommendation, Level 2 (CSS2) was released in 1998 CSS2 builds on the properties in CSS1 and includes new features such as table properties and the ability to change the appearance of the mouse pointer CSS2 builds on the properties in CSS1 and includes new features such as table properties and the ability to change the appearance of the mouse pointer

Inline Styles The most basic method of applying styles is to use inline styles, which allow you to add style information to a single element in a document The most basic method of applying styles is to use inline styles, which allow you to add style information to a single element in a document

Inline Styles You use the style attribute to assign inline style information to an element You use the style attribute to assign inline style information to an element You assign to the style attribute a property declaration enclosed in quotation marks You assign to the style attribute a property declaration enclosed in quotation marks

CSS Values The values you can assign to a CSS property depend on what type of property it is The values you can assign to a CSS property depend on what type of property it is Some properties can be assigned a range of values Some properties can be assigned a range of values

CSS Values For instance, you can assign any font name that is available on a user’s system to the font- family property For instance, you can assign any font name that is available on a user’s system to the font- family property For other properties, you must assign a value from a specific set of values For other properties, you must assign a value from a specific set of values

Length Units Length units refer to the units of measure that you can use in a style declaration to determine the size or positioning of an element Length units refer to the units of measure that you can use in a style declaration to determine the size or positioning of an element Whether a length unit is used for sizing or positioning depends on the property and the element to which it is assigned Whether a length unit is used for sizing or positioning depends on the property and the element to which it is assigned

Length Units You assign a measurement value to a property by assigning the number that represents the measurement, immediately followed by the unit of measure You assign a measurement value to a property by assigning the number that represents the measurement, immediately followed by the unit of measure

CSS Length Units

Length Units CSS length units are either absolute or relative CSS length units are either absolute or relative Absolute length units use an exact measurement to specify the size or placement of an element Absolute length units use an exact measurement to specify the size or placement of an element

Length Units The following CSS length units are absolute: The following CSS length units are absolute: cm (centimeters) cm (centimeters) in (inches) in (inches) mm (millimeters) mm (millimeters) pc (picas) pc (picas) pt (points) pt (points)

Length Units Relative length units are preferred because they adjust properties according to screen size or user preferences Relative length units are preferred because they adjust properties according to screen size or user preferences The following CSS length units are relative: The following CSS length units are relative: em (em space) em (em space) ex (x-height) ex (x-height) px (pixels) px (pixels)

Percentage Units An alternative to relative length units is percentage units, which adjust properties relative to other values An alternative to relative length units is percentage units, which adjust properties relative to other values You assign a percentage unit value to a property by assigning a number that represents the percentage, immediately followed by the percent symbol (%) You assign a percentage unit value to a property by assigning a number that represents the percentage, immediately followed by the percent symbol (%)

Color Units A color unit represents a color value that you can assign to a property A color unit represents a color value that you can assign to a property You can assign a color unit to a property using any one of 16 color names defined in the CSS1 specification You can assign a color unit to a property using any one of 16 color names defined in the CSS1 specification

Color Units

Most graphical computer systems use the RGB color system for specifying colors Most graphical computer systems use the RGB color system for specifying colors You can also assign a color using the RGB color system You can also assign a color using the RGB color system Refer to appendix/resource for information on assigning colors with the RGB color system Refer to appendix/resource for information on assigning colors with the RGB color system