CSS1-1 Cascading Style Sheets (CSS) Xingquan (Hill) Zhu

Slides:



Advertisements
Similar presentations
Dr. Ahmet Cengizhan Dirican BIL 374 Internet Technologies 3. CSS.
Advertisements

1 Dynamic HTML: Cascading Style Sheets™ (CSS). 2 Introduction Cascading Style Sheets (CSS) –Specify the style of your page elements –Spacing, margins,
CS4370/6370 Web Development Cascading Style Sheets (CSS)
CASCADING STYLE SHEETS CSS. 2 What CSS means?  CSS is an extension to basic HTML that allows you to style your web pages.  It separates the part that.
Text Properties, Line Box, CSS. Text Properties Properties related to the display of text. Text-align : left, right, center I like FSU!
Cascading Style Sheets SP.772 May 6, CSS Useful for creating one unified look for an entire web site. Helps to seperate style from content. Can.
Web Design & Development Cascading Style Sheets (CSS)
CS134 Web Design & Development Cascading Style Sheets (CSS) Mehmud Abliz.
Cascading Style Sheets Cyndi Hageman. Applying a Style Sheet  In-line style – used within the HTML tag  Embedded Style Sheet – located in the HTML document.
Using Cascading Style Sheets CSS Structure. Goals Understand how contextual, class and ID selectors work Understand how contextual, class and ID selectors.
COS 381 DAY 3. © 2006 Pearson Addison-Wesley. All rights reserved. 3-2 Agenda Questions? Assignment 1 due January 31 Discussions on CSS –
Lecture CSS: Cascading Style Sheets. What are Styles? Cascading Style Sheets (CSS) is a style sheet language used to describe the presentation semantics.
Lecture 7 Cascading Style Sheets (CSS) Boriana Koleva Room: C54
3.1 Cascading Style Sheets. Motto Fashions fade, style is eternal. —Yves Saint Laurent.
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,
CP476 Internet Computing Lecture 7 HTML & CSS 1 HTML HyperText Markup Language (HTML) is an application of Standard Generalized Markup Language (SGML)
Using Cascading Style Sheets. Introduction to Styles and Properties  Cascading Style Sheets (CSS) are a standard set by the World Wide Web Consortium.
Cascading Style Sheets Example
 2000 Deitel & Associates, Inc. All rights reserved. Chapter 14 – Dynamic HTML: Cascading Style Sheets (CSS) Outline 14.1Introduction 14.2Inline Styles.
CSS Dvijesh Bhatt.
Cascading Style Sheet (CSS)
Tutorial #3 Cascading Style Sheets. Review: Last Class Image sizing Pathnames Project Default Path Relative Path Absolute Path Blackboard Homework Submission.
Cascading Style Sheets, pt 2 ECA 225 Applied Online Programming.
Cascading Style Sheets CSS. CSS - Structure Declaration block Property: identifies what to change Value: how to change it Selector – example h1{ font-size:
WORKING WITH CASCADING
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
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 3 Cascading Style Sheets.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 3 Cascading Style Sheets.
Cascading Style Sheets " Provide means to control and change presentation of HTML documents. " Allow the user to impose a standard style. " Three levels.
Chapter 3 Cascading Style Sheets Introduction  The CSS1 specification was developed in 1996  CSS2 was released in 1998  CSS3 is on its way 
Chapter 3 © 2012 by Addison Wesley Longman, Inc Introduction - The CSS1 specification was developed in CSS2 was released in CSS2.1.
Chapter 3 © 2010 by Addison Wesley Longman, Inc Introduction - The CSS1 specification was developed in CSS2 was released in CSS3 is.
CSS – Cascading Style Sheets Fred Durao
Cascading Style Sheet(CSS). Introduction The CSS 1 specification was developed in 1996 CSS 2 was released in 1998 CSS 3 is on its way CSSs provide the.
Cascading Style Sheets (CSS) ICS213, 1 / 2011 Dr. Seung Hwan Kang.
Chapter 3 © 2005 by Addison Wesley Longman, Inc Introduction - The CSS1 specification was developed in CSS2 was released in CSS3 is.
Chapter 3 Cascading Style Sheets. © 2006 Pearson Addison-Wesley. All rights reserved Introduction - The CSS1 specification was developed in 1996.
Cascading Style Sheets Chapter Four. What are they? A set of style rules that tell the web browser how to present a web page or document. Cascading Style.
Tutorial #3 Cascading Style Sheets. Tutorial #2 Review - Anchors Links to Site DMACC Internal Links Go to Top Mail To me Local.
Lesson 03 // Cascading Style Sheets. CSS Stands for Cascading Style Sheets. We’ll be using a combination of Html and CSS to create websites. CSS is a.
 2008 Pearson Education, Inc. All rights reserved Cascading Style Sheets™ (CSS)
 2008 Pearson Education, Inc. All rights reserved Cascading Style Sheets™ (CSS)
Cascading Style Sheets Robin Burke ECT 270. Outline Midterm The Layout Debate CSS properties Fonts Alignment Color CSS selection selectors pseudo-classes.
 Cascading Style Sheets (CSS) ◦ Used to specify the presentation of elements separately from the structure of the document.  Inline style ◦ declare.
CHAPTER 2 CSS (Cascading Style Sheet). Topics Introduction Inline Styles Embedded Style Sheets Conflicting Styles Linking External Style Sheets Positioning.
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.
 2008 Pearson Education, Inc. All rights reserved Cascading Style Sheets™ (CSS)
1 Web Development CSS (Cascading Style Sheet). 2 1.Setting rules for multiple elements To decrease the amount of typing for setting rules for multiple.
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,
©SoftMoore ConsultingSlide 1 Introduction to HTML: Cascading Style Sheets.
CSS properties Basharat Mahmood, Department of Computer Science, CIIT, Islamabad, Pakistan 1.
Department of Computer Science, Florida State University CGS 3066: Web Programming and Design Spring
Chapter 3 Cascading Style Sheets. © 2006 Pearson Addison-Wesley. All rights reserved Introduction - The CSS1 specification was developed in 1996.
CSS: Cascading Style Sheets Part II. Style Syntax.
ECA 228 Internet/Intranet Design I Cascading Style Sheets.
Chapter 11 & 12 CSS Style Sheets: Intro. Why CSS? Separate presentation from content – more accessible Less work – can change appearance of whole site.
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 CS428 Web Engineering Lecture 07 Font, Text & Background (CSS - II)
CSS Details Cascading Style Sheets. Lesson Overview  In this lesson, you will learn:  To use CSS properties for fonts  Evaluate whether to use pts,
Internet & World Wide Web How to Program, 5/e 1. 2.
3.1 Introduction - HTML is primarily concerned with content, rather
Cascading Style Sheets™ (CSS)
Chapter 6 Cascading Style Sheets™ (CSS)
3.1 Introduction - The CSS1 specification was developed in 1996
3.1 Introduction - The CSS1 specification was developed in 1996
3.1 Introduction - The CSS1 specification was developed in 1996
Cascading Style Sheets™ (CSS)
Presentation transcript:

CSS1-1 Cascading Style Sheets (CSS) Xingquan (Hill) Zhu

CSS1-2 CSS  Introduction  Levels of Style Sheets  Inline style sheets  Document-level style sheets (embedded style sheets)  External style sheets  Style Specification Formats  Depends on the level of the style sheet  Inline vs Document level  Selector Forms  Simple selector, Class selector, Generic selector, Id selector  Pseudo Classes  Property value forms  Fonts, Lists, Alignment of text, Margins, Colors, Backgrounds, Borders

CSS1-3 Introduction  Evolution  The CSS1 specification was developed in 1996  CSS2 was released in middle-1998  CSS3 is on its way  Things you should know about CSS  CSSs provide the means to control and change presentation of HTML documents But Why? Element presentation vs document structure  CSS is not technically HTML, but can be embedded in HTML documents  Style sheets allow you to impose a standard style on a whole document, or even a whole collection of documents  Style is specified for a tag by the values of its properties

CSS1-4 Levels of Style Sheets  Inline  Specified for a specific occurrence of a tag and apply only to that tag  Appears in the tag itself (Example)Example  Document-level style sheets  Apply to the whole document in which they appear  Appears in the head of the document (Example)  External style sheets (Example)Example  Can be applied to any number of documents  In separate files, potentially on any server on the Internet  A tag is used to specify that the browser is to fetch and use an external style sheet file  <link rel = "stylesheet" type = "text/css"  href = " 

CSS1-5 CSS Validation validator/validator-upload.html

CSS1-6 CSS  Introduction  Levels of Style Sheets  Inline  Document-level style sheets (embedded style sheets)  External style sheets  Style Specification Formats  Depends on the level of the style sheet  Inline vs Document level  Selector Forms  Simple selector, Class selector, Generic selector, Id selector  Pseudo Classes  Property value forms  Fonts, Lists, Alignment of text, Margins, Colors, Backgrounds, Borders

CSS1-7 Style Specification Formats  Format depends on the level of the style sheet  Inline  Style sheet appears as the value of the style attribute  General form: style = "property_1: value_11, value_12, value_13; property_2: value_2; … property_n: value_n;“ Final ; optional but preferred Example

CSS1-8 Style Specification Formats: Document level  Style sheet appears as a list of rules that are the content of a tag  The tag must include the type attribute, set to "text/css"  The list of rules  Selector1 {property_1: value_1; property_2: value 2}  Selector2 {property: value}  Comments in the rule list must have a different form - use C comments (/*…*/) Example

CSS1-9 Style Specification Formats: Conflicting Styles  Styles defined by the user take precedence over styles defined by the user agent  Styles defined by authors take precedence over styles defined by the user.  Styles defined for parent elements are also inherited by children (nested) elements  Inheritance Example Inheritance Example  In case of conflict  Properties defined for child and descendant elements have a greater specificity than properties defined for parent and ancestor elements.

CSS1-10 CSS  Introduction  Levels of Style Sheets  Inline  Document-level style sheets (embedded style sheets)  External style sheets  Style Specification Formats  Depends on the level of the style sheet  Inline vs Document level  Selector Forms  Simple selector, Class selector, Generic selector, Id selector  Pseudo Classes  Property value forms  Fonts, Lists, Alignment of text, Margins, Colors, Backgrounds, Borders

CSS1-11 Selector Forms  Simple Selector Form  The selector is a tag name or a list of tag names, separated by commas Simple examples: –H1, h3, p Contextual selectors –Ol ol li –P em

CSS1-12 Selector Forms: Class Selector  Used to allow different occurrences of the same tag to use different style specifications  A style class has a name, which is attached to a tag name  p.narrow {property: value; …}  p.wide {property: value; …}  The class you want on a particular occurrence of a tag is specified with the class attribute of the tag  This is narrow  This is wide class

CSS1-13 Selector Forms: Generic Selector  A generic class can be defined if you want a style to apply to more than one kind of tag  A generic class must be named, and the name must begin with a period .really-big { … }  Use it as if it were a normal style class  … Example

CSS1-14 Selector Forms: id Selector  Allow the application of a style to one specific element  General form: #specific-id {property-value list}  Example: #section14 {font-size: 20} When referring to this the id selector – Welcome to my Home

CSS1-15 Pseudo Classes  Pseudo classes are styles that apply when something happens, rather than because the target element simply exists  Names begin with colons  hover classes apply when the mouse cursor is over the element  focus classes apply when an element has focus Example

CSS1-16 CSS  Introduction  Levels of Style Sheets  Inline  Document-level style sheets (embedded style sheets)  External style sheets  Style Specification Formats  Depends on the level of the style sheet  Inline vs Document level Conflicting Styles  Selector Forms  Simple selector, Class selector, Generic selector, Id selector  Pseudo Classes  Property value forms  Fonts, Lists, Alignment of text, Margins, Colors, Backgrounds, Borders

CSS1-17 Property Value Forms  There are 60 different properties in 7 categories  Fonts  Lists  Alignment of text  Margins  Colors  Backgrounds  Borders

CSS1-18 Units of Measurement  Units (no space is allowed between the value and the unit specification)  px - pixels  in – inches (1 inch = 2.54 cm)  cm - centimeters  mm - millimeters  pt – points (1/72 inch)  pc - picas (12 points)  em - height of the letter ‘M’  ex-height - height of the letter ‘x’  Example  P { line-height:150% } /* 150% of ‘font-size’ */  P {line-height: 1.5em}  #banner { height: 60%; width:70%; margin-left:15%; border: 1px solid #000} /* a box */

CSS1-19 Font Property  Font-family  Value is a list of font names - browser uses the first in the list it has  font-family: Arial, Helvetica, Courier  Generic fonts: serif, sans-serif, cursive, fantasy, and monospace (defined in CSS)  Browser has a specific font for each  If a font name has more than one word, it should be single-quoted  Font-size  Possible values: a length number or a name, such as xx- small, smaller, xx-large, etc Example

CSS1-20 Font Property  Font-style  italic, oblique (useless), normal  Font-weight - degrees of boldness  bolder, lighter, bold, normal  Could specify as a multiple of 100 (100 – 900) 400 is the normal size  Font (shorthand)  For specifying a list of font properties  font: bolder 14pt Arial Helvetica  Order must be: style, weight, size, name(s)

CSS1-21 Text related Properties  Text-decoration  line-through, overline, underline, none  Letter-spacing; Word-spacing  Value is any length property value  Text-align  Left; right; center; justify  Vertical-align  Baseline; sub; super; top; text-top; middle; bottom; text- bottom;  Text-transform  Capitalize; uppercase; lowercase; none  Text-indent  Value (percentage)  Line-height  Value (number, percentage)

CSS1-22 Position properties  Absolute positioning  Position: absolute; top, left, z-index Example # one{ position:absolute; top: 1em; left: 1em; }  Relative positioning  Position: relative; Example Example  Span Grouping element: does not apply any inherent formatting to its contents

CSS1-23 Alignment of Text  Element dimensions  Specify the actual dimensions of each page element Example Example  Nested elements ExampleExample  The text-indent property allows indentation  Takes either a length or a % value  The text-align property has the possible values,  Left (the default), center, right, or justify  Sometimes we want text to flow around another element  the float property  Left, right, and none (default)

CSS1-24 Alignment of Text (contd.)  If we have an element we want on the right, with text flowing on its left, we use the default text-align value (left) for the text and the right value for float on the element we want on the right  <img src = "c210.jpg" style = "float: right" /> -- Some text with the default alignment – left  Clear float  <p style=“float: clear” … Example

CSS1-25 Border related properties Box model  Margin-top (right, left, bottom)  Value (percentage)  Padding-top (right, left, bottom)  Value (percentage)  Border-top-width (right, left, bottom)  Thin, medium, thick (value)  Border-style  Dotted, dashed, double, none  Border-color Example

CSS1-26 Background  Background-color:  Red; #0000FF  Background-image:  url(myimage.jpg)  Background-repeat:  Repeat; no-repeat; repeat-x; repeat-y:  Background-position:  Top; center; bottom; left; right; 20px 20px  Background-attachment:  Fixed; scroll; Background for single elements Example

CSS1-27 List Property  list-style-type  Disc, circle, square, decimal, lower-roman, upper-roman, lower-alpha, upper-alpha, none.  Can also use an image for the bullets in an ordered list  Example

CSS1-28 User Style Sheets  Users format pages based on preference   User Styles .note { font-size: 9pt }   Thanks for visiting my Web site. I hope you enjoy it.  Please Note: This site will be moving soon. Please check periodically for updates.   Example Example

CSS1-29 Other interesting stuff  Cursor ExampleExample  Specifies the type of cursor to be displayed when pointing on an element. Cursor: url(sample.cur), cursor: crosshair  First letter (pseudo element) ExampleExample  Adds special style to the first letter of a text P:first-letter{color:#000; font-size:xx-large}  Mighty Hover ExampleExample Complete CSS2 Properties: nce.asp

CSS1-30 CSS  Introduction  Levels of Style Sheets  Inline  Document-level style sheets (embedded style sheets)  External style sheets  Style Specification Formats  Depends on the level of the style sheet  Inline vs Document level Conflicting Styles  Selector Forms  Simple selector, Class selector, Generic selector, Id selector  Pseudo Classes  Property value forms  Fonts, Lists, Alignment of text, Margins, Colors, Backgrounds, Borders