Cascading Style Sheet (CSS) Instructor: Dr. Fang (Daisy) Tang

Slides:



Advertisements
Similar presentations
Table, List, Blocks, Inline Style
Advertisements

CSS Cascading Style Sheets. Objectives Using Inline Styles Working with Selectors Using Embedded Styles Using an External Style Sheet Applying a Style.
Cascading Style Sheets
Introducing CSS CIS 133 mashup Javascript, jQuery and XML 1.
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.
1 Web Developer & Design Foundations with XHTML Chapter 9 Key Concepts.
กระบวนวิชา 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.
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.
Stylin’ with CSS. 2 Topics What is CSS? Why CSS? CSS Examples.
Introduction to Cascading Style Sheets (CSS) Module 2: HTML Basics LESSON 4.
Beginning Web Site Creation: Dreamweaver CS4. XHTMLCSS  Describes the structure  Content  Collection of styles  Formatting body { background-color:
Web Workshop: CSS Objectives: - “What is CSS?” - Structure of CSS - How to use CSS in your webpage.
4.01 Cascading Style Sheets
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.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 7 TH EDITION Chapter 3 Key Concepts 1 Copyright © Terry Felke-Morris.
© 2007 D. J. Foreman CSS-1 Cascading Style Sheets Styles.
Stylin’ with CSS. 2 Topics What is CSS? Why CSS? CSS Examples.
Principles of Web Design 6 th Edition Chapter 4 – Cascading Style Sheets.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 3 Key Concepts 1 Copyright © Terry Felke-Morris.
Cascading Style Sheets CSS.  Standard defined by the W3C  CSS1 (released 1996) 50 properties  CSS2 (released 1998) 150 properties (positioning)  CSS3.
Tutorial #3 Cascading Style Sheets. Review: Last Class Image sizing Pathnames Project Default Path Relative Path Absolute Path Blackboard Homework Submission.
Chapter 12 Cascading Style Sheets: Part II The Web Warrior Guide to Web Design Technologies.
1 What is CSS?  CSS stands for Cascading Style Sheets  Styles define how to display HTML elements  Styles are normally stored in Style Sheets  Styles.
ITCS373: Internet Technology Week 3: Introduction to CSS Dr. Faisal Al-Qaed.
 This presentation introduces the following: › 3 types of CSS › CSS syntax › CSS comments › CSS and color › The box model.
CIS67 Foundations for Creating Web Pages Professor Al Fichera Rev. September 14, 2010—All HTML code brought to XHTML standards. Reference for CIS127 and.
Just A Few More Fun Objectives 1 Having Some Fun With Java Script 2 Using Style Sheets.
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.
CO1552 – Web Application Development Cascading Style Sheets.
Tutorial #3 Cascading Style Sheets. Tutorial #2 Review - Anchors Links to Site DMACC Internal Links Go to Top Mail To me Local.
Introduction to CSS. What is CSS?  Cascading Style Sheets  Used for styling HTML  Also important in javascript and jquery for selectors  External.
The Web Wizard’s Guide To DHTML and CSS Chapter 1 A Review of CSS1.
Introduction to Programming the WWW I CMSC Winter 2003 Lecture 7.
Stylin’ with CSS Monday October 8 th and Tuesday October 9 th.
CSS Cascading Style Sheets. CSS Advantages Greater typography and page layout control Style is separate from structure Styles can be stored in a separate.
XP Tutorial 7New Perspectives on HTML and XHTML, Comprehensive 1 Working with Cascading Style Sheets Tutorial 7.
Web Design and Development for Business Lecture 4 Cascading Style Sheet (CSS)
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.
Advanced Web Development Instructor: Thomas Bombach.
Course created by Sarah Phillips BBCD Melbourne BAPDCOM Version 1 – April 2013.
Cascading Style Sheets Level 2. Course Objectives, Session 1 Level 1 Quick Review Chapter 8: Adding Graphics to Web Pages Chapter 9: Sprucing Up Your.
Cascading Style Sheets
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. Source W3Schools
XP Review 2 New Perspectives on JavaScript, Comprehensive1 Introducing Cascading Style Sheets Formatting Web Pages with CSS.
Web Design (12) CSS Introduction. Cascading Style Sheets - Defined CSS is the W3C standard for defining the presentation of documents written in HTML.
CSS Cascading Style Sheets A very brief introduction CSS, Cascading Style Sheets1.
Cascading Style Sheets Primary readings Presentations Explain & review projects with class mates.
Web Technologies Beginning Cascading Style Sheets (CSS) 1Copyright © Texas Education Agency, All rights reserved.
Designing Web Pages The case for CSS. The Power of CSS css Zen Garden
How to… Cascading Style Sheets. How to Insert a Style Sheet When a browser reads a style sheet, it will format the document according to it. There are.
Style Sheets. Coding Style Sheets  Style sheets use RULES to create the style  A selector (a tag or user-defined style name)  and then declarations.
Intro to CSS Christy. What is CSS?  Cascading Style Sheets  Separates content from presentation  Defines how to display HTML elements  Provides control.
CSS Cascading Style Sheets *referenced from
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.
Basic Webpage Design Cascading Style Sheet (CSS).
Blended HTML and CSS Fundamentals 3 rd EDITION Tutorial 3 Introducing Cascading Style Sheets.
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.
1 Cascading Style Sheets
CONFIGURING COLOR AND TEXT WITH CSS Chapter 3. Cascading Style Sheets (CSS) Used to configure text, color, and page layout. Launched in 1996 Developed.
WEB FOUNDATIONS CSS Overview. Outline  What is CSS  What does it do  Where are styles stored  Why use them  What is the cascade effect  CSS Syntax.
CSS.
Cascading Style Sheets (CSS)
Introduction to Web programming
What are Cascading Stylesheets (CSS)?
Presentation transcript:

Cascading Style Sheet (CSS) Instructor: Dr. Fang (Daisy) Tang

What is CSS? CSS stands for Cascading Style Sheets Styles define how to display HTML elements Styles are normally stored in Style Sheets Styles were added to HTML 4.0 to solve a problem External style sheets can save a lot of work External style sheets are stored in CSS files Multiple style definitions will cascade into one Example: my homepage Another example: http://www.w3schools.com/css/demo_default.htm (.html)

Multiple Ways to Define Style External Style Sheet (.css files) Internal Style Sheet Inline Styles Examples: http://www.w3schools.com/html/html_styles.asp More: default style, CSS changed by JavaScript

Multiple Styles Cascade Into One What style will be used when there is more than one style? Browser default External style sheets are included Embedded styles (inside the <head> tag) override external styles Inline styles (inside an HTML element) override both embedded and external styles Styles modified with JavaScript override all other styles

CSS Style Rule p { font-size: x-large ; background-color: yellow } property names declarations selector string declaration block

Selector Strings Type selector: ID selector: Element type, such as body, p, hr, etc. See previous example Multiple element types using the same style are separated by comma h1, h2, h3, h4, h5, h6 {background-color:purple} ID selector: #p1, #s1 {background-color: blue} <p id=“p1”> … </p> <span id=“s1”>…</span> id values are case-sensitive

Sector Strings, Continue … Class selector: .myitalic {font-style: italic} .myred {color: red} <span class=“myitalic myred”> … </span> class values are case sensitive multiple classes can be applied, separated by space All but a few elements, such as html, head, and elements that appear as content of head, have the class attribute ID and class selectors can be prefixed by an element type name p.right {text-align: right} p#left {text-align: left} <p class=“right”> … </p> <p id=“left”> … </p>

Selector Strings, Continue … A selector within the content of certain element types ul span {color: green}: applies to a span element within a ul element ul ol li {letter-spacing: 1em}: applies to an li element within an ol element that is within a ul element CSS comments /* This is a comment */ p { text-align: center; /* This is another comment */ color: black; font-family: arial }

How to Insert a Style Sheet? External style sheet <head> <link rel="stylesheet" type="text/css" href="mystyle.css" /> </head> Internal style sheet <style type="text/css"> hr {color: sienna} p {margin-left: 20px} </style> Inline style <p style="color: sienna; margin-left: 20px"> This is a paragraph </p>

CSS Basics Background Text Font Border Outline Margin Padding List Table

CSS Advanced CSS dimension CSS classification CSS positioning CSS pseudo-class CSS pseudo-element CSS media types

Font Generic font families defined in HTML and CSS are: Serif Sans-serif Monospace Cursive Fantasy There are a lot other font families, but might not be well supported

How to Select a Font Family? Rules-of-Thumb Don’t use more than 3-4 fonts on any one page Don’t change the font in mid sentence unless you have a very good reason Sans-serif for online, serif for print Monospace for typewriter and code Script and fantasy for accents Sans-serif fonts are the basis of your site, for example: Arial, geneva, helvetica, lucida sans, trebuchet, verdana Verdana is a font family that was actually invented for use on the web

Selecting Font, Continue Use serif fonts for print If you have print friendly versions of your site, use serif fonts Examples: garamond, georgia, new york, times, times new roman Monospace for bode examples Use it to provide instructions, give examples, or imply typewritten text Examples: courier, courier new, lucida console, monaco Example: http://www.csupomona.edu/~ftang/www/courses/CS299-S09/examples/font.html

More Case Studies of CSS from CSS Tutorials @ http://webdesign.about.com/od/css/Cascading_Style_Sheets.htm

Case Study Understanding CSS “float” http://webdesign.about.com/od/advancedcss/a/aa010107.htm

Case Study Tableless layouts http://webdesign.about.com/od/css/a/aa102102a.htm There are many potential problems about using table for layout http://webdesign.about.com/od/layout/a/aa111102a.htm Frames can also be substituted by CSS http://webdesign.about.com/od/css/a/aa110402a.htm

Case Study Fixed width layouts vs. Liquid layouts Fixed width layouts: http://webdesign.about.com/od/layout/i/aa060506.htm Fixed width layouts: The width of the entire page is set with a specific numerical value Liquid layouts: The width of the entire page is flexible depending upon how wide the viewer’s browser is

Case Study How to build a 3-column layout: Steps: Draw your layout http://webdesign.about.com/od/csstutorials/ss/css_layout_sbs.htm Steps: Draw your layout Create and style a Container element Use a Headline Tag for the Header To get 3 columns, start by building 2 columns Then add 2 columns inside the wide second column Add in the Footer Add in your personal style and content

Free Web Templates http://www.csszengarden.com http://webdesign.about.com/od/websitetemplates/a/bl_layouts.htm http://www.csszengarden.com