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…

Slides:



Advertisements
Similar presentations
Intro to HTML. HTML HTML = HyperText Markup Language Used to define the content of a webpage HTML is made up of tags and attributes Content.
Advertisements

Intro To Cascading Style Sheets By Mario Yannakakis.
CSS Cascading Style Sheets. Objectives Using Inline Styles Working with Selectors Using Embedded Styles Using an External Style Sheet Applying a Style.
Ideas to Layout Beginning web layout using Cascading Style Sheets (CSS). Basic ideas, practices, tools and resources for designing a tableless web site.
CSS The basics { }. CSS Cascading Style Sheets - language used to – describe html appearance & formatting Style Sheet - file that describes – how html.
Cascading Style Sheets (CSS) “Styles” for short. Pg. 418.
Cascading Style Sheets
HTML Overview - Cascading Style Sheets (CSS). Before We Begin Make a copy of one of your HTML file you have previously created Make a copy of one of your.
© 2004, Robert K. Moniot Chapter 6 CSS : Cascading Style Sheets.
“Cascading Style Sheets” for styling WWW information DSC340 Mike Pangburn.
Web Design with Cascading Style Sheet Lan Vu. Overview Introduction to CSS Designing CSS Using Visual Studio to create CSS Using template for web design.
Introduction to Cascading Style Sheets (CSS) Module 2: HTML Basics LESSON 4.
Web Workshop: CSS Objectives: - “What is CSS?” - Structure of CSS - How to use CSS in your webpage.
CM143 Week 4 Introducing CSS. Cascading Style Sheets A definition for the style in which an element of the webpage will be displayed Border width, colour,
Computing Concepts: CSS. Aims  To understand the uses of css  To understand the different types of css  To be able to create a css file  To be able.
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,
Cascading Style Sheets (CSS) Instructor: Mr. Ahmed Al Astal ITGD4104 Department Requirement for senior student University of Palestine Faculty of IT.
STYLING THE WEBSITE - EXTERNAL CSS BY JORGE MARTINEZ.
 ult.htm ult.htm  This website illustrates the use of CCS (style sheets)
CSS Style Rules Guang Tong, Zhan L;lo’p[ Css Style Rule Guang Tong Zhan Three ways to insert CSS 1 External style sheet 2 Internal style sheet 3 Inline.
Dreamweaver -- CSS. Dreamweaver -- MX New icons are added in MX Most of the features commonly used in web design, and are same as FrontPage. New feature.
Cascading Style Sheets (CSS) 1.  What is CSS?  Why CSS?  How to write a CSS? 2.
Using Styles and Style Sheets for Design
Cascading Style Sheet (CSS)
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.
I NTRO TO CSS IAT100 Spring I NTRO TO CSS Covered in this lesson: Overview What is CSS? Why to use CSS? CSS for Skinning your Website Structure.
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.
Css. Definition Cascading style sheet (CSS) Cascading Style Sheets (CSS) is a simple mechanism for adding style (e.g. fonts, colors, spacing) to Web documents.
Internet Web Publishing III. Intro to Cascading Style Sheets Patricia Roberts.
© 2011 Delmar, Cengage Learning Chapter 8 Using Styles and Design Style Sheets for Design.
CS134 Web Design & Development Cascading Style Sheets (CSS) Mehmud Abliz.
Css. Definition Cascading style sheet (CSS)  It is a simple mechanism for adding style (e.g. fonts, colors, spacing) to Web documents.
ECA225 Applied Interactive Programming Cascading Style Sheets, pt 1 ECA 225 Applied Online Programming.
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…
INT222 - Internet Fundamentals Shi, Yue (Sunny) Office: T2095 SENECA COLLEGE.
HTML GUIDE Press F5 and then Click on the links on the left to get to the section you want Section 1: Getting Started Section 2: Moving Banner Section.
Cascading Style Sheets Creating a Uniform Site. Style Sheets  Style sheets are used for conformity on a web page or web site.  Style sheets eliminate.
LEARN THE QUICK AND EASY WAY! VISUAL QUICKSTART GUIDE HTML and CSS 8th Edition Chapter 8: Working with Style Sheets.
Lesson 15: Cascading Style Sheets. Objectives Identify ways to apply Web page formatting with Cascading Style Sheets (CSS1 and CSS2) using various methods.
DYNAMIC HTML What is Dynamic HTML: HTML code that allow you to change/ specify the style of your web pages. Example: specify style sheet, object model.
Introduction to CSS. Why CSS? CSS Provides Efficiency in Design and Updates CSS relatively easy to use Can give you more flexibility and control Faster.
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.
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.
Department of Computer Science, Florida State University CGS 3066: Web Programming and Design Spring
Practice for Chapter 3: Assume that you are a freelance web designer and need to create a website to promote your freelance company.
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.
ECA 228 Internet/Intranet Design I Cascading Style Sheets.
HTML5 and CSS3 Illustrated Unit C: Getting Started with CSS.
What is CSS? A set of style rules that tell the web browser how to present a web page or document. – In earlier versions of HTML, style characteristics,
Cascading Style Sheets Using HTML. What are they? A set of style rules that tell the web browser how to present a web page or document. In earlier versions.
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.
Getting Started with CSS
>> Introduction to CSS
Madam Hazwani binti Rahmat
Introduction to Web programming
IS333: MULTI-TIER APPLICATION DEVELOPMENT
Website Design 3
Cascading Style Sheets - Building a stylesheet
DynamicHTML Cascading Style Sheet Internet Technology.
CS134 Web Design & Development
DynamicHTML Cascading Style Sheet Internet Technology.
Using Cascading Style Sheets (CSS)
Tutorial 3 Working with Cascading Style Sheets
Web Design and Development
Web Design & Development
Cascading Style Sheets - Building a stylesheet
Presentation transcript:

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…  a style sheet: collection of styles for a Web page or Website  style sheets use common language and syntax  main style sheet standard: Cascading Style Sheets (CSS)

3 CSS history  developed by WWW Consortium ( the same organization that develops standards for HTML  designed to augment HTML, not replace it  a whole new way of formatting Web pages  provides several tools not available with standard HTML  different versions o CSS1 released in 1996 (fonts, text, color, background) o CSS2 released in 1998 (positioning, visual formatting) o CSS3, latest standard being developed

4 Benefits of style sheets  a design tool  makes website design more flexible  easier to maintain and modify  more aesthetically interesting  consistent look

5

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

7 Style types o Inline styles  styles are added to each tag within the HTML file  style only affects that particular tag

8 Using inline styles  format a single section, better use inline style  syntax o tag is the name of an HTML element (h1, h2, p, etc) o style declarations  the styles defined for the particular tag  must be enclosed within double quotation marks  use semi-colon separate multiple attributes o e.g.

But what if there are same tags appearing multiple times in the webpage and you want to format all of them uniformly 9

10 Style types (contd.) o Inline styles  styles are added to each tag within the HTML file  style only affects that particular tag o Embedded or global styles  applied to an entire HTML file  allowing the Web designer to modify the appearance of any tag in the document

11 Creating an embedded style  embedded style, a style applied to various sections within a Web page  use tag within the … section  within tag, enclose style declarations  syntax style declarations

12 Embedded Style  syntax for style declaration: selector{attribute1:value1; attribute2:value2;...} o collection of attributes and values  selector o identifies an element in your document, e.g., a heading o identifies attributes and values within the braces for that element  example h1 {text-align: center; color: red}

13 Embedded Style (contd.)  Simple Practice exercise:  Using Embedded styles, convert “course description” and “reference texts” in main.html to blue

14 Grouping selectors  What if there are many tags or blocks which follows the same style throughout the page?  apply the same declaration to a group of selectors by including all of the selector names separated by commas h1, h2, h3, h4, h5, h6 {text-align: center; color: red}

Now the next level!  Just the way we changed the styles uniformly in a single webpage, how about applying that across multiple webpages, i.e., your website  We now need an external style sheet 15

16 Style types (contd.) o Inline styles  styles are added to each tag within the HTML file  style only affects that particular tag o Embedded or global styles  applied to an entire HTML file  allowing the Web designer to modify the appearance of any tag in the document o Linked or external style sheets  placed in an external file, linked with Web pages  allowing Web designer to modify the appearance of tags in several documents across the website

17 Creating an external style sheet 1. Crate a new text file 2. Save it using the extension “.css ”, 3. Place your styles here  Within a style sheet, tag is NOT needed, only need style declarations

18 Creating an external style sheet  Create a text file containing style declarations /* Author: author name */ h1, h2, h3, h4, h5, h6 {text-align: center; color: red}  Name the file: mystylesheet.css  Remember: o Only external stylesheet creation not sufficient o Need to link the stylesheet and the html pages where you need the styles

19 Linking to style sheets with  Example: link to a style sheet named “ mystylesheet.css, ”  Placement within … of the webpage where you need the styles

Style Conflict  Apply external, embedded and inline all three types of styling with h1 tag o External:  Text-align: center and color: red o Embedded:  Text-align: center and color: blue o Inline:  Text-align: center and color: green  What is the result? 20

21 Style precedence  in case of styles conflict, precedence is determined in the following order: 1. an inline style overrides any embedded style or external style sheet 2. an embedded style overrides an external style sheet 3. an external style sheet overrides the internal style rules set by the Web browser

Understanding Cascading Order 22

Style Inheritance  If a style is not specified for an element, it inherits the style of its parent element. This is called style inheritance body {color: green} p {color: red}  In the above example, the body element is the parent element 23

Practice exercise  All the elements in my unordered (bulleted) list must be red throughout the website  All the elements in my ordered (numbered) list must be blue throughout the website 24