Working with Cascading Style Sheets. Introducing Cascading Style Sheets Style sheets are files or forms that describe the layout and appearance of a document.

Slides:



Advertisements
Similar presentations
CSS Cascading Style Sheets. Objectives Using Inline Styles Working with Selectors Using Embedded Styles Using an External Style Sheet Applying a Style.
Advertisements

1 Cascading Style Sheets Continued Different kinds of selectors in a style sheet –Simple- Pseudo-Class –Contextual- Pseudo-Element –Class Image Styles.
Cascading Style Sheets
Today CSS HTML A project.
Making Things Look Nice: Visual Appearance and CSS CMPT 281.
CNIT 133 Interactive Web Pags – JavaScript and AJAX Review CSS.
Recognizing the Benefits of Using CSS 1. The Evolution of CSS CSS was developed to standardize display information CSS was slow to be supported by browsers.
กระบวนวิชา 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.
9-May-15 More CSS. 2 A different emphasis CSS is the same for XML as it is for HTML and XHTML, but-- XML contains no display information If you want your.
Tutorial 5 Working with the Box Model. XP Objectives Understand the box model Create padding, margins, and borders Wrap text around an image Float a block-level.
Tutorial 6 Creating Fixed-Width Layouts
Chapter 7 Using Advanced Cascading Style Sheets HTML5 & CSS 7 th Edition.
Tutorial 3 Working with Cascading Style Sheets. XP Objectives Review the history and concepts of CSS Explore inline styles, embedded styles, and external.
Using Cascading Style Sheets CSS Basics. Goals Understand basic syntax of Cascading Style Sheets (CSS) Understand basic syntax of Cascading Style Sheets.
Cascading Style Sheets Controlling the Display Of Web Content.
XP 1 Working with Cascading Style Sheets Creating a Style for Online Scrapbooks Tutorial 7.
Tutorial 4 Creating Special Effects with CSS
MORE Cascading Style Sheets (The Positioning Model)
4.01 Cascading Style Sheets
Working with Cascading Style Sheets. 2 Objectives Introducing Cascading Style Sheets Using Inline Styles Using Embedded Styles Using an External Style.
CSS (Cascading Style Sheets): How the web is styled Create Rules that specify how the content of an HTML Element should appear. CSS controls how your web.
Principles of Web Design 6 th Edition Chapter 4 – Cascading Style Sheets.
Chapter 11 Cascading Style Sheets: Part I The Web Warrior Guide to Web Design Technologies.
XP Tutorial 7New Perspectives on Creating Web Pages with HTML, XHTML, and XML 1 Working with Cascading Style Sheets Creating a Style for Online Scrapbooks.
Tutorial 4 Creating Special Effects with CSS. XP Objectives Work with CSS selectors Create styles for lists Create and apply class styles Create a rollover.
The Characteristics of CSS
New Perspectives on XML, 2nd Edition Tutorial 5 1 TUTORIAL 5 WORKING WITH CASCADING STYLE SHEETS.
XP New Perspectives on XML Tutorial 5 1 TUTORIAL 5 CSS Tutorial – Carey ISBN
CSS Introduction Cascading Style Sheets Provides a great deal of control over the presentation of the document HTML indicates both semantics of a document.
Tutorial 4 Creating Special Effects with CSS
CSS Positioning Creating Special Effects with CSS CS202 Working with Cascading Style Sheets (Chapter 4) CS202 1.
1 Cascading Style Sheets (CSS) Part 2. 2 The Sources of Style Sheets.
Tutorial 3 Working with Cascading Style Sheets (CSS)
Cascading Style Sheets by Pavlovic Nenad by. Presentation Contents  What is CSS?  Why CSS?  Types of Style Sheets  Style Sheets Syntax  Box Formatting.
 This presentation introduces the following: › 3 types of CSS › CSS syntax › CSS comments › CSS and color › The box model.
CIS 1315 – Web Development for Educators CIS 1315 HTML Tutorials 3 & 4: Working With CSS.
WRT235: Writing in Electronic Environments CSS Classes, IDs, divs.
Introduction to Programming the WWW I CMSC Winter 2003 Lecture 7.
MySQL and PHP Review CSS. Cascading Style Sheet (CSS) Style sheets are files or forms that describe the layout and appearance of a document. Cascading.
Introduction to Cascading Style-sheets (CSS) Basharat Mahm ood, Department of Computer Science, CIIT,Islamabad, Pakistan 1.
XP Tutorial 7New Perspectives on HTML and XHTML, Comprehensive 1 Working with Cascading Style Sheets Tutorial 7.
Lecture 2 - HTML and CSS Review SFDV3011 – Advanced Web Development 1.
Professor Waterman Cascading Style Sheets (CSS) is a language that works with HTML documents to define the way content is presented. The presentation.
Chapter 6 Introducing Cascading Style Sheets Principles of Web Design, 4 th Edition.
 2004 Prentice Hall, Inc. All rights reserved. Chapter 6 - Cascading Style Sheets™ (CSS) Outline 6.1 Introduction 6.2 Inline Styles 6.3 Embedded Style.
Course created by Sarah Phillips BBCD Melbourne BAPDCOM Version 1 – April 2013.
1 © Netskills Quality Internet Training, University of Newcastle Using Style Sheets in Dreamweaver CS © Netskills, Quality Internet Training, University.
Cascading Style Sheets CSS. Source W3Schools
XP Review 2 New Perspectives on JavaScript, Comprehensive1 Introducing Cascading Style Sheets Formatting Web Pages with CSS.
Introduction to CSS September 20, Introduction Cascading Style Sheets (CSS) –Separation of structure from presentation CSS guide and tutorial.
CNIT 132 – Week 4 Cascading Style Sheets. Introducing Cascading Style Sheets Style sheets are files or forms that describe the layout and appearance of.
CSS Cascading Style Sheets A very brief introduction CSS, Cascading Style Sheets1.
Tutorial 4 Creating Special Effects with CSS. New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition 2 Objectives Work with CSS selectors.
Tutorial 4 Creating Special Effects with CSS. New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition 2 Objectives Work with CSS selectors.
Tutorial 4 Creating Special Effects with CSS. XP Objectives Work with CSS selectors Create styles for lists Create and apply class styles Create a rollover.
XP Review 1 New Perspectives on JavaScript, Comprehensive1 Introducing HTML and XHTML Creating Web Pages with HTML.
HTML and Dreamweaver November 11th. Agenda Box Model Displaying and positioning elements – Padding – Margin – Float – Display – Position HTML Demo.
NASRULLAHIBA.  It is time to take your web designing skills to the next level with Cascading Style Sheets (CSS). They are a way to control the look and.
HTML 5 AND CSS Dr Mohd Soperi Mohd Zahid Semester /16.
XP Tutorial 7New Perspectives on HTML and XHTML, Comprehensive 1 Working with Cascading Style Sheets Creating a Style for Online Scrapbooks Tutorial 7.
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.
CSS.
Working with Cascading Style Sheets
4.01 Cascading Style Sheets
Cascading Style Sheets
Madam Hazwani binti Rahmat
Tutorial 3 Working with Cascading Style Sheets
4.01 Cascading Style Sheets
Presentation transcript:

Working with Cascading Style Sheets

Introducing Cascading Style Sheets Style sheets are files or forms that describe the layout and appearance of a document Cascading Style Sheets, or CSS, is a style sheet language used on the Web –CSS specifications are maintained by the World Wide Web Consortium (W3C) –Three versions of CSS exist: CSS1, CSS2, CSS2.1, and CSS3

Cascading Style Sheets CSS1 introduced styles for the following document features: –Fonts –Text –Color –Backgrounds –Block-level Elements New Perspectives on HTML and XHTML, Comprehensive3

Cascading Style Sheets CSS2 introduced styles for the following document features: –Positioning –Visual Formatting –Media Types –Interfaces CSS 2.1 did not add any new features to the language New Perspectives on HTML and XHTML, Comprehensive4

Cascading Style Sheets CSS3 (The CSS3 specification is still under development by W3C. However, many of the new CSS3 properties have been implemented in modern browsers.) introduces styles for the following document features: –User Interfaces –Accessibility –Columnar layout –International Features –Mobile Devices –Scalable Vector Graphics New Perspectives on HTML and XHTML, Comprehensive5

Applying a Style Sheet Three ways to apply a style to an HTML or XHTML document: 1.Inline Styles 2.Embedded Styles 3.External Styles

1. Using Inline Styles Inline styles are easy to use and interpret because they are applied directly to the elements they affect.

2. Using Embedded Styles You can embed style definitions in a document head using the following form: The Title style declarations Where style declarations are the declarations of the different styles to be applied to the document

3. Using an External Style Sheet Because an embedded style sheet only applies to the content of one file, you need to place a style declaration in an external style sheet to apply to the headings in the rest of the Web site An external style sheet is a text file that contains style declarations –It can be linked to any page in the site, allowing the same style declaration to be applied to the entire site

Using an External Style Sheet You can add style comments as you develop an external style sheet Use the link element to link a Web page to an external style sheet You can also link a single document to several style sheets

Applying a single style sheet to multiple documents

Applying multiple sheets to a single document

Style Precedence order: 1.Inline styles 2.Embedded styles 3.External style sheet 4.Browser default styles

Using IDs and Classes Use an id to distinguish something, like a paragraph, from the others in a document –For example, to identify a paragraph as “head”, use the code : …

Classes HTML and XHTML require each id be unique– therefore an id value can only be used once in a document You can mark a group of elements with a common identifier using the class attribute …

Applying a style to a class

Applying a style to a class and element

Working with the div Element The div element is a generic block-level element content

Working with the Box Model The box model is an element composed of four sections: –Margin –Border –Padding –content

Working with the Box Model

Styles to set padding are similar to styles to set margins: –padding-top: value –padding-right: value –padding-bottom: value –padding-left: value

Sizing Elements and Floating an Element You can define the width of columns in a columnar layout using: width: value You can use CSS to set an element’s height using: height: value You can float a paragraph using: float: position (see positioning objects)

Using Pseudo-Classes and Pseudo-Elements A pseudo-class is a classification of an element based on its status, position, or current use in the document

Using Pseudo-Classes and Pseudo-Elements Rollover effects can be created using pseudo-classes Pseudo-elements are elements based on information about an element’s content, use or position

Positioning Objects with CSS The different positioning styles in the original CSS1 specifications were known as CSS- Positioning or CSS-P To place an element at a specific position on a page use: position: type; top: value; right: value; bottom: value; left: value;

Floating an Element New Perspectives on HTML and XHTML, Comprehensive26 The syntax for the float style is: float: position

Floating an Element To float an element, use the style float: position where position is none (to turn off floating), left or right To display an element clear of a floating element, use the style clear: position where position is none, left, right, or both New Perspectives on HTML and XHTML, Comprehensive27

Stacking Elements Specify stacking order with: z-index: value z-index: 3 z-index: 1 z-index: 2