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

1 © Netskills Quality Internet Training, University of Newcastle Introducing Cascading Style Sheets © Netskills, Quality Internet.
HIGH LEVEL OVERVIEW: CSS CSS SYNTAX CONSISTS OF A SET OF RULES THAT HAVE 3 PARTS: A SELECTOR, A PROPERTY, AND A VALUE. IT’S NOT NECESSARY TO REMEMBER THIS.
CSS-Formatting Review Cascading Style Sheets addstyle to your HTML web pages.
Intro To Cascading Style Sheets By Mario Yannakakis.
CSS Cascading Style Sheets. What is CSS? CSS stands for Cascading Style Sheets (the page—or sheet—helps you create a style that will cascade across all.
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
1 Cascading Style Sheets™ (CSS) Outline 5.1 Introduction 5.2 Inline Styles 5.3 Embedded Style Sheets 5.4 Conflicting Styles 5.5 Linking External Style.
CSS Digital Media: Communication and design 2007.
Today CSS HTML A project.
CSS. CSS, or Cascading Styles Sheets, is a way to style HTML. Whereas the HTML is the content, the style sheet is the presentation of that document.
Introduction to CSS.
Cascading Style Sheets. CSS stands for Cascading Style Sheets and is a simple styling language which allows attaching style to HTML elements. CSS is a.
HyperText Markup Language (HTML) Uses plain text to add markup instructions to a file. If you can't produce it with a standard keyboard, it can't go into.
Cascading Style Sheets Basics. Why use Cascading Style Sheets? Allows you to set up a series of rules for all pages in a site. The series may be changed.
1 Web Developer & Design Foundations with XHTML Chapter 9 Key Concepts.
CSW131 Steven Battilana 1 CSW 131 – Chapter 5 (More) Advanced CSS Prepared by Prof. B. for use with Teach Yourself Visually Web Design by Ron Huddleston,
กระบวนวิชา CSS. What is CSS? CSS stands for Cascading Style Sheets Styles define how to display HTML elements Styles were added to HTML 4.0 to.
Chapter 8 Creating Style Sheets.
Tutorial 3 Introducing Cascading Style Sheets. XP New Perspectives on Blended HTML, XHTML, and CSS2 Objectives Learn about Cascading Style Sheets Write.
Introduction to Cascading Style Sheets (CSS) Module 2: HTML Basics LESSON 4.
Cascading Style Sheets (CSS) 1.  What is CSS?  Why CSS?  How to write a CSS? 2.
Cascading Style Sheet (CSS)
 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.
Tutorial 5 Formatting with CSS. Objectives Session 5.1 – Evaluate why CSS styles are used – Determine where to write styles – Create an element selector.
Tutorial #3 Cascading Style Sheets. Tutorial #2 Review - Anchors Links to Site DMACC Internal Links Go to Top Mail To me Local.
Introduction to CSS. What is CSS?  Cascading Style Sheets  Used for styling HTML  Also important in javascript and jquery for selectors  External.
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.
Web Technologies Beginning Cascading Style Sheets (CSS) 1Copyright © Texas Education Agency, All rights reserved.
CSCE Chapter 3 (Cascading Style Sheets) CSCE General Applications Programming Benito Mendoza 1 By Benito Mendoza Department of Computer.
Blended HTML and CSS Fundamentals 3 rd EDITION Tutorial 3 Introducing Cascading Style Sheets.
Internet & World Wide Web How to Program, 5/e Copyright © Pearson, Inc All Rights Reserved.
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…
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.
CONFIGURING COLOR AND TEXT WITH CSS Chapter 3. Cascading Style Sheets (CSS) Used to configure text, color, and page layout. Launched in 1996 Developed.
WEB FOUNDATIONS CSS Overview. Outline  What is CSS  What does it do  Where are styles stored  Why use them  What is the cascade effect  CSS Syntax.
Web Development & Design Foundations with XHTML
CS3220 Web and Internet Programming CSS Basics
>> Introduction to CSS
Introduction to CSS.
Cascading Style Sheets
Madam Hazwani binti Rahmat
Using Cascading Style Sheets Module B: CSS Structure
Programming the Web using XHTML and JavaScript
Cascading Style Sheet (CSS)
IS333: MULTI-TIER APPLICATION DEVELOPMENT
Website Design 3
Cascading Style Sheets - Building a stylesheet
Introduction to CSS.
Cascading Style Sheets
CSS Style Sheets: Intro
Cascading Style Sheets Color and Font Properties
Cascading Style Sheets
Introduction to Cascading Style Sheets (CSS)
Cascading Style Sheets™ (CSS)
Web Design and Development
CS3220 Web and Internet Programming CSS Basics
Exercise 9 Skills You create and use styles to create formatting rules that can easily by applied to other pages in the Web site. You can create internal.
Introduction to CSS.
CS3220 Web and Internet Programming CSS Basics
Cascading Style Sheets
Cascading Style Sheets - Building a stylesheet
Cascading Style Sheets
Cascading Style Sheets
Cascading Style Sheets III B. Com (Paper - VI) & III B
Cascading Style Sheets
Introduction to Cascading Style Sheets (CSS)
CS332A Advanced HTML Programming
Presentation transcript:

Cascading Style Sheets References: Dietel, Dietel & Nieto. Chapter 14 HTML for the World wide web Elizabeth Castro Chapters 13 -16

Creating Internal Styles Local: Embedded within individual HMTL tags. Internal: Created within HEAD tags of same document. External: Similar structure to internal, but saved as a separate ‘.css’ file. Creating Internal Styles Between the opening and closing HEAD tags (<HEAD>…</HEAD>), insert the <STYLE> tag. Type the name of the tag whose property you wish to define such as H1 or P. Type an opening ‘ { ‘ to mark the beginning of the tag’s properties. Define as many properties as desired, separating each property with a semicolon. Type the closing ‘ } ’

<HTML><HEAD><TITLE>Cascading Style Sheets</TITLE> H1 {text-align:center;background:green;color:red;font:normal 20pt “Lithos Regular”} P {text-align:justify; text-indent:8pt; font:10pt “Verdana”} </STYLE> </HEAD> <BODY> <H1>…………………. <P>…………………… </BODY></HTML>

You can define properties for several tags at once by separating each tag with a comma, i.e. H1, H2, H3 {color:red;} To define styles for an embedded tag, you type the parent tag first and separate it from the child tag with a space, and define the properties, i.e. H1 EM {color:red} Hiding Styles from old browsers Add ‘<!--’ after the opening STYLE tag and --> before the closing STYLE tag.

Defining Styles for Classes <-- H1 {color:red; font:20pt “Verdana”} P {color:blue; font:14pt “Lithos Regular”} --> </STYLE> Defining Styles for Classes Assign classes to the elements in the HTML document by defining the class within the element e.g. <H1 CLASS=intro> In the STYLE section of the page, define the properties for the class H1.intro {color:blue} Note that you can only define classes for internal and external style sheets.

Identifying particular tags Rather than creating a whole class of HTML tags, you can identify particular tags, and apply styles to them as well as apply JavaScript to them. This is done by adding an ID attribute to the tag. <STYLE> <!-- P#intro {color:blue; font:italic bold} --> </STYLE> <BODY> <H1>….. <P ID=intro>….. </BODY>

Creating Custom HTML tags There are 2 generic tags that can be combined with classes and ID to create custom HTML tags. These are DIV and SPAN. DIV is for Block-level elements, while SPAN is for inline elements. Block-level elements usually begin on a new line, and may contain other block-level or inline elements, e.g. <P>, <H1> Inline elements usually do not begin on a new line, and can only contain other inline elements, e.g. <B> and <FONT>.

<STYLE> <!-- DIV.intro {background:aqua} DIV.main {background:blue} H1 {text-align:center; background:green} --> </STYLE> </HEAD> <BODY> <DIV CLASS=“intro”> <H1>Introduction</H1>….. <P>….. </DIV> <DIV CLASS=“main”> <P>……………</P> </DIV>

At the beginning, you thought this course would be difficult. Custom Inline tags (SPAN) Syntax is similar to block-level custom tags. <STYLE> SPAN.initialcap {font-size:200%} SPAN.allcaps {font-variant:small-caps} </STYLE></HEAD> <BODY> <H1>Introduction<H1> <SPAN CLASS=“initialcap”>A</SPAN> <SPAN CLASS=“allcaps”>t the beginning, you thought this course would be difficult.</SPAN> At the beginning, you thought this course would be difficult.

Creating an External Style Sheet Created in a separate file and saved with a ‘.css’ extension Ideal for giving all the pages on your website the same look and feel. Each page would get it’s style from the external style sheet. When a change is made in an external style sheet, all the pages that reference it are automatically updated. Creating an External Style Sheet Create a new text document Type the name of the tag whose properties you wish to define Type the ‘ { ‘ Define as many properties as desired as for Internal styles Type the closing ‘ } ‘ , and save the file with a ‘.css’ extension.

Some Styling Possibilities Creating Local Styles Within the HTML tag that you want to format, type STYLE=“property:value” Separate multiple properties with semicolons <BODY> <P STYLE=“background:yellow; color:red”> ……………………………………… </P> Some Styling Possibilities Setting Font family: Font-family: familyname1,familyname2 where 1 and 2 are your first and second choices respectively.

To create Italics: font-style:italic To remove Italics: font-style:normal To create Bold formatting: font-weight:bold To remove Bold formatting: font-weight:normal Setting font size: Define absolute or relative size such as font-size:20pt or font-size:larger. You may also set the percentage e.g. font-size:150% Setting line height (amount of space between each line in a paragraph): line-height:n where n is the number that would be multiplied by the font size to obtain the desired line height Setting Text Colour: color:colour name or hexadecimal representation To align text: text-align:left, right or center Underlining text: text-decoration:underline To remove underlining: text-decoration:none