Cascading Style Sheets

Slides:



Advertisements
Similar presentations
Cascading Style Sheets
Advertisements

CSS Cascading Style Sheets. Objectives Using Inline Styles Working with Selectors Using Embedded Styles Using an External Style Sheet Applying a Style.
CSS Digital Media: Communication and design 2007.
Today CSS HTML A project.
Introducing CSS CIS 133 mashup Javascript, jQuery and XML 1.
Lecture 5 Use Cases and Style Sheets
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.
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.
© 2004, Robert K. Moniot Chapter 6 CSS : Cascading Style Sheets.
Cascading Style Sheet CSS CS1520 Ali Alanjawi. 2 TA Information Ali Alanjawi Homepage: Office:
Part 3 Introduction to CSS. CSS Text Text Styles h1 {color: green} // rgb(0,255,0), #00ff00 h2{letter-spacing: 0.5cm} // 2px h3 {text-align: right} //
© 2007 D. J. Foreman CSS-1 Cascading Style Sheets Styles.
CSS: Cascading Style Sheets. 2 History HTML tags were originally designed to define the content of a document. The layout of the document was supposed.
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.
Tutorial #3 Cascading Style Sheets. Tutorial #2 Review - Anchors Links to Site DMACC Internal Links Go to Top Mail To me Local.
CSS Tutorial 1 Introduction Syntax How to use style specifications. Styles.
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.  Standard defined by the W3C  CSS1 (released 1996) 50 properties  CSS2 (released 1998) 150 properties (positioning)  CSS3.
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.
CSS: Cascading Style Sheets Part II. Style Syntax.
Cascading Style Sheets Robin Burke ECT 270. Outline CSS properties Fonts Alignment Color CSS selection selectors.
1 Cascading Style Sheets
WebD Introduction to CSS By Manik Rastogi.
Cascading Style Sheets
3.1 Introduction - HTML is primarily concerned with content, rather
HTML WITH CSS.
Web Development & Design Foundations with XHTML
CS3220 Web and Internet Programming CSS Basics
The Internet 10/11/11 Fonts and Colors
CSS: Cascading Style Sheets
( Cascading style sheet )
HTML WITH CSS.
Cascading Style Sheets
Cascading Style Sheets
Styling with Cascading Stylesheets Very Quick Introduction
Introducing :CSS Cascading Style Sheets in 5 Lessons.
Cascading Style Sheets
Madam Hazwani binti Rahmat
Using Cascading Style Sheets Module B: CSS Structure
Cascading Style Sheet (CSS)
Cascading Style Sheets
IS333: MULTI-TIER APPLICATION DEVELOPMENT
3 Configuring Color & Text With CSS.
The Internet 10/13/11 The Box Model
Cascading Style Sheets
Formatting Text with HTML and CSS
CSS Style Sheets: Intro
Cascading Style Sheets
What are Cascading Stylesheets (CSS)?
Cascading Style Sheets
Web Development & Design Foundations with H T M L 5
Web Programming Language
CS3220 Web and Internet Programming CSS Basics
Part 1: Cascading Style Sheets
Lecture Review What is a hybrid app? What does a UI framework do?
CS3220 Web and Internet Programming CSS Basics
CIS 133 mashup Javascript, jQuery and XML
Cascading Style Sheets
Lesson 5 Topic B – Basic Text & Fonts
Cascading Style Sheets
Cascading Style Sheets
Stylin’ with CSS.
Cascading Style Sheets
Stylin’ with CSS.
Introduction to Cascading Style Sheets (CSS)
Cascading Style Sheets
CS332A Advanced HTML Programming
Cascading Style Sheets
CGS 3066: Web Programming and Design Fall 2019
Presentation transcript:

Cascading Style Sheets © 2004 D. J. Foreman

Purpose Consistency of formatting Modify tags Ease of formatting "Layers" within a document © 2004, D. J. Foreman

3 types of styles In-line Embedded or Global Linked or External Specific to each tag-use Embedded or Global Applies to whole file Linked or External Rules saved in a separate file Can apply to multiple files © 2004, D. J. Foreman

Syntax rules TAG {attributes} values may be merged Attribute : value ; ; not needed after last attribute values may be merged Separated by blanks values may contain choices Separated by commas © 2004, D. J. Foreman

Example of an Inline Style <B style="color: red; font-size:120%"> Changes only this one tag Note use of : ; style used as an attribute in the TAG, so quotes required here No { } for inline styles © 2004, D. J. Foreman

Example of an Embedded Style <style type='text/css'> H1, H2 {color: blue; font-family: Arial, Sans-serif } note comma for choices B {color: red; font-size:120%} LI B {color: gold; font-size:120%} </style> NOTE: no quotes inside { } © 2004, D. J. Foreman

Example of External Style H1, B {color: red; font-size: 110%} Note: no <STYLE> tags required here The Style file "mystyle.css" <link href="mystyle.css" rel="stylesheet" type="text/css"> <body> <b>this bold text will be red & 110%</b> </body> The Web Page file Type= specifies the language used for the styles © 2004, D. J. Foreman

Generic Font-family Names Serif Sans-serif Monospace Cursive Fantasy © 2004, D. J. Foreman

Specific Font-family Names Arial Times Roman Courier New Gigi Lucida Calligraphy Comic Sans MS Example: H1 {font-family: times roman, arial, serif} © 2004, D. J. Foreman

Font-size Length 0.5in, 20px, 36pt Keyword xx-small, x-small, Percent 105% Relative 2em, 5ex Example: H1 {font-size: xx-large} © 2004, D. J. Foreman

Inheritance BODY {color: blue} H1, H2 {font-size: 115%} B {color: red} <B> tags will override body color value Note: <style> tags needed if this is an embedded style © 2004, D. J. Foreman

Font Attributes Font-family serif Font-size  3em medium larger* Font-style  italic normal oblique Font-weight  bold example H1 {Font: 2em italic bold arial, courier} Note merging of values, followed by choices © 2004, D. J. Foreman

Anchor-tag Attributes A:visited {styles} A:link {styles} A:active {styles} A:hover {styles} © 2004, D. J. Foreman

Some Misc. Attributes Text-indent: 10% 3em Vertical-align: 10% -10% 3mm Letter-spacing: .3em Word-spacing: .4em Line-height: 2 5mm 120% ("2" means 2*ratio of line-height/font-size) Text-decoration: none underline © 2004, D. J. Foreman

Lists UL {list-style-type: circle} UL UL {list-style-type: disk} UL UL UL {list-style-type: square} list-style-position: inside or outside inside is like a hanging-indent © 2004, D. J. Foreman

Style Classes Classes allow re-use of a style Two steps: Define a style class Use the class in the HTML © 2004, D. J. Foreman

Classes (2 types) Bound Syntax: tag.classname {styles} Style definition: H1.myheader {color:red} Usage: <H1 class='myheader'> text</H1> Unbound Syntax: .classname {styles} Style definition: .myreds {color:red;} Usage: <H1 class='myreds'>text</H1> <B class='myreds'>text</B> © 2004, D. J. Foreman

DIV & SPAN <DIV ID='name' or CLASS='name'> assigns a NAME to an enclosed block: <P>, <BLOCKQUOTE>, <Hn>, <OL>, <UL>, <BODY>, <IMG> </DIV> Designed for single-use <SPAN ID='name' or CLASS='name'> for non-block elements: <B>, etc © 2004, D. J. Foreman

Layer Definitions <STYLE> #layer1 {position:absolute; top:400px; left:10px; } #layer2 { etc. } </STYLE> (note: "#" for an ID vs a period for a class) © 2004, D. J. Foreman

Layer Usage <DIV ID="layer1"> • note: no # here • but it IS on the definition </DIV> © 2004, D. J. Foreman

Examples .grn {color: green; font-size: 20px;} #lyr {position: 10px} <body> <span class='grn'> green text </span> <span id='lyr'>a layer</span> <span class='grn' id='lyr'>green layer</span> </body> Note: cannot use #'s 2 and 3 in same page (ID's are for 1-time use per page) © 2004, D. J. Foreman