Cascading Style Sheets

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

Cascading Style Sheets: Basics I450 Technology Seminar Copyright 2003, Matt Hottell.
Cascading Style Sheets (CSS) “Styles” for short. Pg. 418.
© 2004, Robert K. Moniot Chapter 6 CSS : Cascading Style Sheets.
กระบวนวิชา 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.
Cascading Style Sheets. Slide 2 Lecture Overview Overview of Cascading Style Sheets (CSS) Ways to declare a CSS CSS formatting capabilities New features.
Using Cascading Style Sheets CSS Basics. Goals Understand basic syntax of Cascading Style Sheets (CSS) Understand basic syntax of Cascading Style Sheets.
Outline IS400: Development of Business Applications on the Internet Fall 2004 Instructor: Dr. Boris Jukic CSS: Cascading Style Sheets.
Cascading Style Sheets Controlling the Display Of Web Content.
Using Cascading Style Sheets CSS Structure. Goals Understand how contextual, class and ID selectors work Understand how contextual, class and ID selectors.
4.01 Cascading Style Sheets
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 (CSS) 1.  What is CSS?  Why CSS?  How to write a CSS? 2.
Cascading Style Sheet (CSS)
Website Development & Management Working with Style Rules Instructor: John Seydel, Ph.D. CIT Fall
 This presentation introduces the following: › 3 types of CSS › CSS syntax › CSS comments › CSS and color › The box model.
Cascading Style Sheets CSS by Pavlovic Nenad by. 2Cascading Style Sheets Presentation Contents What are CSS? What are CSS? History of CSS History of CSS.
IS 360 Declaring CSS Styles. Slide 2 Introduction Learn about the three ways to declare a style Inline / embedded / external Learn about the effect of.
Cascading Style Sheets Part 1. CSS vs HTML HTML: Originally intended to markup structure of a document (,...,,,,,...) CSS Developing technology, CSS1,
CSS Tutorial 1 Introduction Syntax How to use style specifications. Styles.
ECA225 Applied Interactive Programming Cascading Style Sheets, pt 1 ECA 225 Applied Online Programming.
INT222 - Internet Fundamentals Shi, Yue (Sunny) Office: T2095 SENECA COLLEGE.
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.
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,
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.
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
Internet & World Wide Web How to Program, 5/e 1. 2.
WebD Introduction to CSS By Manik Rastogi.
Cascading Style Sheets
Working with Cascading Style Sheets
Cascading Style Sheet.
Web Development & Design Foundations with XHTML
Getting Started with CSS
HTML5 and CSS3 Illustrated Unit D: Formatting Text with CSS
4.01 Cascading Style Sheets
Basics of Web Design Chapter 4 Cascading Style Sheets Basics Key Concepts Copyright © 2013 Terry Ann Morris, Ed.D.
CSS: Cascading Style Sheets
IS 360 Declaring CSS Styles
Madam Hazwani binti Rahmat
CX Introduction to Web Programming
Web Developer & Design Foundations with XHTML
Cascading Style Sheets contd: Embedded Styles
Using Cascading Style Sheets Module B: CSS Structure
Cascading Style Sheets
Basics of Web Design Chapter 4 Cascading Style Sheets Basics Key Concepts Copyright © 2013 Terry Ann Morris, Ed.D.
Dynamic HTML.
Intro to CSS CS 1150 Fall 2016.
Introduction to web design discussing which languages is used for website designing
CSS Intro.
Cascading Style Sheets
IS333: MULTI-TIER APPLICATION DEVELOPMENT
Cascading Style Sheets: Basics
Intro to CSS CS 1150 Spring 2017.
Styles and the Box Model
Basics of Web Design Chapter 4 Cascading Style Sheets Basics Key Concepts Copyright © 2013 Terry Ann Morris, Ed.D.
Second CSS Lecture Applications to XML
DynamicHTML Cascading Style Sheet Internet Technology.
What are Cascading Stylesheets (CSS)?
Cascading Style Sheets
Cascading Style Sheets™ (CSS)
DynamicHTML Cascading Style Sheet Internet Technology.
Some Stuff You Need to Know
Part 1: Cascading Style Sheets
Exercise 9 Skills You create and use styles to create formatting rules that can easily by applied to other pages in the Web site. You can create internal.
Cascading Style Sheets
Cascading Style Sheets
4.01 Cascading Style Sheets
CGS 3066: Web Programming and Design Fall 2019
Presentation transcript:

Cascading Style Sheets Cascading Style Sheets, level 1 (CSS1) became a W3C Recommendation in December 1996. CSS2, May 1998, builds on CSS1 and adds support for media-specific style sheets (e.g. printers and aural devices), downloadable fonts, element positioning and tables.

HTML ELEMENTS An HTML element is the entire declaration of a tag, or tag and content. (black is markup) <tag attribute=value> or <tag attribute=value>content</tag> Element and Tag are referred to with the same word

What does CSS do? Control the style (fonts, colors, leading, margins, typefaces, etc.) of a Web document without compromising its structure. Visual design issues, such as page display, can be addressed separately from the HTML structure. This can allow for control over more HTML objects, and with fewer instructions!

Drawbacks? Only 4.0 Browsers and up. Browser Differences Netscape does not support CSS as well as Internet Explorer does. Fewer functions Limited Inheritance

selector { property: value; } CSS Syntax Instructor must explain this slide.

Comments /* anything found between a fore-slash and an asterisk is a comment. Such as this explanation. How ironic. */

Properties Font size Colors Margins Borders and much, much more! background font Margins Borders and much, much more!

Values Colors Sizes Fonts Hexadecimal, RGB, HTML names Points Pixels Percentage Picas Em's Inches Centimeters Fonts Can be declared dynamically as in HTML

Selector Declaration

Selectors: what is getting style. Tags Classes Tag Specific Classes IDs

CSS Implementation Linked Stylesheets Embedded Stylesheets Inline Styles

HTML Tags as Selector Any HTML tag Any use of the tag will be displayed according to its declaration. Can still use regular HTML formatting tags such as the Heading tags for non-CSS browsers. Heading tags are used by some search engines for relevance of keywords.

Classes Can be applied to any HTML tag. Any tag assigned this class will display according to the class decloration. .classname { property: value; } Assigned to a tag with the attribute “class” <tag class=“classname”>content</tag>

Tag Specific Classes p.classname { property: value; } Ensures that the class can be applied ONLY to one certain tag. Such as the Paragraph tag in this example.

ID Selection You can create a selector for an individual HTML element. The HTML element must have an ID attribute. In the CSS it is denoted with the “#” #copyright { font-size: 10pt; } <span id=“copyright”>© 2011</span>

Linked Style Sheets HTML pages can “point” or link to an external CSS file. Multiple HTML pages can point to the same Style Sheet, thus an entire site’s display can be controlled from one file! <link rel=“stylesheet” type=“text/css” href=“stylesheet.css”> rel - the type of relationship this link represents type - MIME type of linked document href - relative path to the style sheet

Embedded Style Sheets Used by, and throughout, one HTML page Found in the HEAD of an HTML page. <head> <style type=“text/css”> <!-- selector { property: value; } .classname { --> </style> </head> Comment tags ensure non-CSS browsers do not display declarations as text.

Inline Syles Styles can be declared within a tag for use in that tag only. This is done with the attribute “style” <tag style=“property: value; property: value;”>Content</tag>

The Cascade Embedded Styles cascade over Linked Style sheets Note: the LINK tag should go BEFORE the STYLE tags! Inline Styles cascade over Embedded Styles

Grouped Selectors By separating selectors with a comma you can declare more than one at once. h1, h2, h3 { property: value; }

Contextual Selectors By separating selectors with a space you can affect nested tags. ul ul { property: value; } Will declare all second level nested lists.

Images To point to an image (for backgrounds, list bullets, etc.) the following syntax is used:\ body { background-image: url( “file-path” ) } url is typed and file-path is either a relative or absolute file path (no space between url and the parenthesis) body { background-image: url( “images/bg.gif” )

Spans and Divs To add a specific style, to a specific area- the use of these two tags is general. span - an Inline tag that allows content to exist inline with it (e.g. b, font, i,) div - a block element - can contain other tags such as SPAN

CSS2 Pseudo Classes There are aspects of CSS2 which Microsoft’s Internet Explorer (as well as some other “rebel browsers”) support. a:link a:visited a:active a:hover

A Tag Pseudo Classes Each is its own declaration and are adjusted according to current browser status including mouse position. a:hover activated when the mouse is positioned over a link a:active activated when the mouse clicks on the link

Multiple Link Types Define the A tag and/or as many classes of the A tag that you want/need. a { color: #0000ff; font-size: 12pt; } a:hover { color: #ff0000; font-size: 16pt; a.bottomnav { font-size: 9pt; a.bottomnav:hover { color: #ffff00; Inherited categories must be changed or overridden In this slide a.bottomnav:hover inherits the new size, so if the font is not to change the a:bottomnav has to have the desired font-size to be defined.