XP 1 Working with Cascading Style Sheets Creating a Style for Online Scrapbooks Tutorial 7.

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.
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.
1 Pengantar Teknologi Internet W03: CSS Cascading Style Sheets.
CIS 1310 – HTML & CSS 6 Layout. CIS 1310 – HTML & CSS Learning Outcomes  Describe & Apply the CSS Box Model  Configure Float with CSS  Designate Positioning.
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.
Chapter 8 Creating Style Sheets.
Creating Special Effects with CSS
Working with Cascading Style Sheets
Tutorial 6 Creating Fixed-Width Layouts
Cascading Style Sheets Controlling the Display Of Web Content.
Tutorial 4 Creating Special Effects with CSS
MORE Cascading Style Sheets (The Positioning Model)
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.
Working with Cascading Style Sheets. Introducing Cascading Style Sheets Style sheets are files or forms that describe the layout and appearance of a document.
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: Using CSS for Page Layout. 2 Objectives Session 4.1 Explore CSS layout Compare types of floating layouts Examine code for CSS layouts View.
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.
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.
INTRODUCTION TO HTML5 CSS Styles. Understanding Style Sheets  HTML5 enables you to define many different types of content on a web page, including headings,
Tutorial 4 Creating Special Effects with CSS
CSS Positioning Creating Special Effects with CSS CS202 Working with Cascading Style Sheets (Chapter 4) CS202 1.
Cascading Style Sheets. Defines the presentation of one or more web pages Similar to a template Can control the appearance of an entire web site giving.
1 Cascading Style Sheets (CSS) Part 2. 2 The Sources of Style Sheets.
Cascading Style Sheets by Pavlovic Nenad by. Presentation Contents  What is CSS?  Why CSS?  Types of Style Sheets  Style Sheets Syntax  Box Formatting.
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 Summer 2004 Lecture 7.
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.
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.
Cascading Style Sheets (CSS). A style sheet is a document which describes the presentation semantics of a document written in a mark-up language such.
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.
INTRODUCTORY Tutorial 5 Using CSS for Layout and Printing.
Positioning and Printing Creating Special Effects with CSS.
CNIT 132 – Week 4 Cascading Style Sheets. Introducing Cascading Style Sheets Style sheets are files or forms that describe the layout and appearance of.
3.2 Cascading Style Sheets. 2 Positioning Elements Normally, elements are laid out on the page in the order that they are defined in the XHTML document.
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.
Microsoft Expression Web 3 – Illustrated Unit D: Structuring and Styling Text.
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.
Maureen Smith Professor Tutorial 4.  Review  Session 4.1  Session 4.2  Session 4.3  Review.
XP Review 1 New Perspectives on JavaScript, Comprehensive1 Introducing HTML and XHTML Creating Web Pages with HTML.
Introduction to Programming the WWW I CMSC Summer 2003 Lecture 6.
- WE’LL LOOK AT THE POSITION PROPERTY AND HOW CSS RESOLVES CONFLICTS BETWEEN STYLING INSTRUCTIONS The position property; CSS specificity hierarchy.
HTML and Dreamweaver November 11th. Agenda Box Model Displaying and positioning elements – Padding – Margin – Float – Display – Position HTML Demo.
Understanding CSS Cascading Style Sheets control the presentation of content in HTML pages Style Sheets separate formatting from the content –Styles defined.
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.
Introduction to Programming the WWW I CMSC Summer 2004 Lecture 8.
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.
Working with Cascading Style Sheets
Cascading Style Sheets
For the World Wide Web Positioning Objects with CSS
Tutorial 3 Working with Cascading Style Sheets
Tutorial 4 Creating Special Effects with CSS
Presentation transcript:

XP 1 Working with Cascading Style Sheets Creating a Style for Online Scrapbooks Tutorial 7

XP 2 Introducing Cascading Style Sheets Style sheets are files or forms that describe the layout and appearance of a document Style sheets are files or forms that describe the layout and appearance of a document Separate content from display information Separate content from display information Cascading Style Sheets, or CSS, is a style sheet language used on the Web 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) CSS specifications are maintained by the World Wide Web Consortium (W3C) Three versions of CSS exist: CSS1, CSS2, and CSS3 Three versions of CSS exist: CSS1, CSS2, and CSS3

XP 3 4 Factors How web document is rendered to user How web document is rendered to user Media - computer screen, printers, etc. Media - computer screen, printers, etc. Browser/OS Browser/OS User - most browsers allow user to override default settings User - most browsers allow user to override default settings Code - separate content from instructions how to render Code - separate content from instructions how to render

XP 4 Applying a Style Sheet Three ways to apply a style to an HTML or XHTML document: Three ways to apply a style to an HTML or XHTML document: Inline Styles - applied to specific element Inline Styles - applied to specific element Embedded Styles - in document head - for document elements Embedded Styles - in document head - for document elements External Styles - separate document - applied to a group of web pages External Styles - separate document - applied to a group of web pages

XP 5 Using Inline Styles Inline styles are easy to use and interpret because they are applied directly to the elements they affect. Inline styles are easy to use and interpret because they are applied directly to the elements they affect. <element style=“style1: value1; style2: value2; style3: value3;…”>

XP 6 Using Embedded Styles You can embed style definitions in a document head using the following form: You can embed style definitions in a document head using the following form:<style> style declarations </style> Style attributes Style attributes Applying embedded style Applying embedded style

XP 7 Using an External Style Sheet Because an embedded style sheet only applies to the content of the start.htm 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 - could do it with one file Because an embedded style sheet only applies to the content of the start.htm 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 - could do it with one file An external style sheet is a text file that contains style declarations 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 It can be linked to any page in the site, allowing the same style declaration to be applied to the entire site

XP 8 Using an External Style Sheet You can add style comments as you develop an external style sheet - should do You can add style comments as you develop an external style sheet - should do Use the link element to link a Web page to an external style sheet Use the link element to link a Web page to an external style sheet You can import the content of one style sheet into another - must come before any other style declarations - recommended over link - supported by more browsers You can import the content of one style sheet into another - must come before any other style declarations - recommended over link - supported by more browsers

XP 9 Understanding Cascading Order You can link a single style sheet to multiple documents in your Web site by using the link element or element You can link a single style sheet to multiple documents in your Web site by using the link element or element You can also link a single document to several style sheets You can also link a single document to several style sheets

XP 10 Applying a single style sheet to multiple documents

XP 11 Applying multiple sheets to a single document

XP 12 Style Precedence 1. External style sheet 2. Embedded styles 3. Inline styles If same weight - last declaration - takes precedence If same weight - last declaration - takes precedence Override precedence - important property Override precedence - important property

XP 13 Style Inheritance If a style is not specified for an element, it inherits the style of its parent element; This is called style inheritance. If a style is not specified for an element, it inherits the style of its parent element; This is called style inheritance. Get the bigger declaration Get the bigger declaration Override - specify alternate for one of the descendant elements Override - specify alternate for one of the descendant elements

XP 14 Working with Selectors CSS allows you to work with a wide variety of selectors to match different combinations of elements CSS allows you to work with a wide variety of selectors to match different combinations of elements Use contextual selectors to apply a style based on the context in which an element is used Use contextual selectors to apply a style based on the context in which an element is used

XP 15 Simple and contextual selectors

XP 16 Attribute Selectors Create an attribute selector to select an element based on the element’s attributes Create an attribute selector to select an element based on the element’s attributes

XP 17 Using IDs and Classes Use an id to distinguish something, like a paragraph, from the others in a document 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 : For example, to identify a paragraph as “head”, use the code : … …

XP 18Classes HTML and XHTML require each id be unique– therefore an id value can only be used once in a document 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 You can mark a group of elements with a common identifier using the class attribute … …

XP 19 Applying a style to a class

XP 20 Applying a style to a class and element

XP 21 Sizing Elements and Floating an Element Style sheets instead of tables - more flexible, applied to multiple documents, easier to maintain, smaller file sizes, more manageable code Style sheets instead of tables - more flexible, applied to multiple documents, easier to maintain, smaller file sizes, more manageable code Not supported by all browsers Not supported by all browsers You can define the width of columns in a columnar layout using: width: value 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 use CSS to set an element’s height using: height: value You can float a paragraph using: float: position You can float a paragraph using: float: position

XP 22 Working with the div Element The div element is a generic block-level element - treat several elements as a single unit The div element is a generic block-level element - treat several elements as a single unit<div>content</div>

XP 23 Setting the Display Style Values of the display style

XP 24 Setting the Display Style Values of the display style

XP 25 Working with the Box Model The box model is an element composed of four sections: The box model is an element composed of four sections: Margin - between element and other content Margin - between element and other content Border Border Padding - between element’s content and border Padding - between element’s content and border content content

XP 26 The Box Model

XP 27 Working with the Box Model Styles to set padding are similar to styles to set margins: Styles to set padding are similar to styles to set margins: padding-top: value padding-top: value padding-right: value padding-right: value padding-bottom: value padding-bottom: value padding-left: value padding-left: value

XP 28 Border Styles

XP 29 Border Style Types

XP 30 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 A pseudo-class is a classification of an element based on its status, position, or current use in the document

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

XP 32 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; Type - positioning type applied to element Absolute - place at specific coordinates Relative - in relation to its default, normal position Fixed - does not scroll with rest of page Inherited - inherit position style of parent element

XP 33 Working with Overflow and Clipping The overflow property syntax: overflow: type

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

XP 35 Working with Different Media Specify output styles for particular devices in the media attribute of the link and style elements

XP 36 Rule You can also specify the output media within a style sheet type {style declarations} Where media is one of the supported media types and style declarations are the styles associated with that media type

XP 37 Media Groups CSS2 uses media groups to describe basic facets of different media– and to differentiate between different types of media based on the ways they render content Continuous or paged Visual, aural, or tactile Grid (for character grid devices) or bitmap Interactive or static

XP 38 Media Groups

XP 39 Hiding Elements Two different styles that allow you to hide elements: Display style - “none” - element is not rendered by output device Visibility style -

XP 40 Comparing the visibility and display styles Visibility hidden Object is hidden but still is part of the page flow Display: none Object is hidden and is removed from the page flow

XP 41 Using Print Styles You can specify the size of a page, margins, internal padding, etc. of the page box Page pseudo-classes and named pages First Left Right Name Setting the page size Displaying crop marks Page breaks - relation to the elements Before After Always, avoid, left, right, auto, inherit

XP 42 Assign #18 Case 1, pg print code and finished product, black and white is acceptable. Assign #19 Case 2, pg print code and finished product, black and white is acceptable.