Introduction to Web Site Development Steven Emory Department of Computer Science California State University, Los Angeles Lecture 5: Cascading Style Sheets.

Slides:



Advertisements
Similar presentations
CSS The basics { }. CSS Cascading Style Sheets - language used to – describe html appearance & formatting Style Sheet - file that describes – how html.
Advertisements

XP Introducing Cascading Style Sheets With Cascading Style Sheets (CSS), you can create one or more documents that control the appearance of some or all.
Introduction to Cascading Style Sheets (CSS) Module 2: HTML Basics LESSON 4.
Outline IS400: Development of Business Applications on the Internet Fall 2004 Instructor: Dr. Boris Jukic CSS: Cascading Style Sheets.
Web Workshop: CSS Objectives: - “What is CSS?” - Structure of CSS - How to use CSS in your webpage.
Cascading Style Sheets Scripting with Style. CSS versus HTML  Ways to format in HTML –HTML Tag extensions –Converting Text to images –Page Layout with.
Using Cascading Style Sheets CSS Structure. Goals Understand how contextual, class and ID selectors work Understand how contextual, class and ID selectors.
W EB S ITE L ECTURE C ASCADING S TYLE S HEETS. Cascading Style Sheets (CSS) Introduction CSS Objectives – Provide more control over web site content presentation.
Stylin’ with CSS. 2 Topics What is CSS? Why CSS? CSS Examples.
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.
HIGHER COMPUTING CSS. WHAT IS CSS? CSS: Cascaded Style Sheets used to separate a web site’s content(information) from its style(how it looks).
TECH2018 Multimedia and the Internet More about CSS and Page Layouts.
Principles of Web Design 6 th Edition Chapter 4 – 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 CS3505. What are CSS? Method for adding style attributes consistently to HML tags Cascading because styles are applied in order.
Chapter 11 Cascading Style Sheets: Part I The Web Warrior Guide to Web Design Technologies.
Cascading Style Sheets Billy Toy Cascading Style Sheets Syntax review How to Implement style sheets Background properties Text properties.
CSS Dvijesh Bhatt.
HTML - Quiz #2 Attendance CODE:
HTML/CSS Hyper Text Markup Language. CSS Cascading Style Sheets.
Cascading style sheets (CSS)
Cascading Style Sheets (CSS) 1.  What is CSS?  Why CSS?  How to write a CSS? 2.
INTRODUCTION TO WEB DEVELOPMENT AND HTML Lecture 09: Cascade Style Sheets - Spring 2011.
Tutorial #3 Cascading Style Sheets. Review: Last Class Image sizing Pathnames Project Default Path Relative Path Absolute Path Blackboard Homework Submission.
Today’s objectives  Complete web page  Using xhtml & CSS  Adding CSS to documents Embed url(File);  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.
CSS: Cascading Style Sheets. 2 What are Style Sheets A style sheet is a mechanism that allows to specify how HTML (/XHTML/XML) pages should look The style.
(CSS) More Details Instructor: Mr. Ahmed Al Astal ITGD4104 Department Requirement for senior student University of Palestine Faculty of IT.
Today’s objectives  Review  CSS | Rules | Declarations  HTML Structure document  Class asignment.
Using Cascading Style Sheet As you create more web pages, you may wish to impose a consistent look for all of your web pages or for group of related pages.
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.
CSS CSS is short for C ascading S tyle S heets. It is a new web page layout method that has been added to HTML to give web developers more control over.
Tutorial #3 Cascading Style Sheets. Tutorial #2 Review - Anchors Links to Site DMACC Internal Links Go to Top Mail To me Local.
Cascading Style Sheet Bayu Priyambadha, S.Kom. Definition Cascading Style Sheets (CSS) form the presentation layer of the user interface. –Structure (HTML)
CSS. HTML: Looking Back HTML dictates order, structure, and function Does very little to specify layout or visual rendering.
Introduction to CSS. What is CSS?  Cascading Style Sheets  Used for styling HTML  Also important in javascript and jquery for selectors  External.
MySQL and PHP Review CSS. Cascading Style Sheet (CSS) Style sheets are files or forms that describe the layout and appearance of a document. Cascading.
Cascade Style Sheet Introduction. What is CSS?  CSS stands for Cascading Style Sheets  Styles define how to display HTML elements  Styles were added.
Cascading Style Sheets
Cascading Style Sheets CSS.  Standard defined by the W3C  CSS1 (released 1996) 50 properties  CSS2 (released 1998) 150 properties (positioning)  CSS3.
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.
CS 174: Web Programming September 9 Class Meeting Department of Computer Science San Jose State University Fall 2015 Instructor: Ron Mak
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,
Copyright © 2006, Jumail, FSKSM, UTM Slide 1 Cascading Style Sheets (CSS)
Introduction to Web Site Development John Hurley Department of Computer Science California State University, Los Angeles Lecture 5: Cascading Style Sheets.
CSS Cascading Style Sheets A very brief introduction CSS, Cascading Style Sheets1.
CSS properties Basharat Mahmood, Department of Computer Science, CIIT, Islamabad, Pakistan 1.
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
CSS: Cascading Style Sheets Part II. Style Syntax.
CSS Cascading Style Sheets *referenced from
Creating Layouts with CSS. Span tag Here is some underlined text. Here is some blinking text. Here's some bold text.
Font-Family, Color and Background. Basics  CSS rule: Selector (multiple separated by, ) Declaration (multiple separated by ; ) Example: p { color: red;
Tutorial 3 Designing a Web Page with CSS
Introduction to Web Site Development Department of Computer Science California State University, Los Angeles Lecture 5: Cascading Style Sheets.
HTML5 and CSS3 Illustrated Unit C: Getting Started with CSS.
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)
HTML & CSS Contents: the different ways we can use to apply CSS to The HTML documents CSS Colors and Background CSS Fonts CSS Text CSS box model: padding,
CSS DHS Web Design. Location Between the & Start with – End with –
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…
CSS Cascading Style Sheets. Session Checklist ► Learn why style sheets are needed and their advantages and disadvantages ► Learn the format of a style.
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.
CONFIGURING COLOR AND TEXT WITH CSS Chapter 3. Cascading Style Sheets (CSS) Used to configure text, color, and page layout. Launched in 1996 Developed.
CSS: Cascading Style Sheets
Intro to CSS CS 1150 Fall 2016.
Cascading Style Sheets - Building a stylesheet
Intro to CSS CS 1150 Spring 2017.
Cascading Style Sheets - Building a stylesheet
Presentation transcript:

Introduction to Web Site Development Steven Emory Department of Computer Science California State University, Los Angeles Lecture 5: Cascading Style Sheets

History Used to separate data and presentation 1996 – CSS – CSS 2.0 Current – CSS About CSS 2.1 contains 115 presentation properties Slight variation between browsers

CSS Syntax Syntax: STYLE = SELECTOR { RULES } RULES = PROPERTY;PROPERTY;…;PROPERTY; PROPERTY = NAME:VALUE Example: p { color:red; background-color:black; }

CSS Syntax A style is a list of properties that can be applied to one or more HTML elements to change the way the element is presented or rendered A selector defines what HTML elements a style affects A rule is a list of properties separated by a semicolon A property is a value that can be altered to change the way an HTML element is presented

The HTML STYLE Attribute All HTML elements have the STYLE attribute, for which we can apply one or more CSS style rules to these elements (inline style)STYLE attribute To specify a single style rule: STYLE="CSS style rule;" To specify multiple style rules, separate your rules with a semicolon STYLE="CSS style rule 1;CSS style rule 2;“ The last semicolon is optional

The HTML STYLE Attribute Examples: This is red text. This is red text over a black background.

Color and Backgrounds color background-color background-image background-repeat background-position background-attachment

Internal Style Sheets Styles are defined in same document, but in the HEAD section using the STYLE elementSTYLE element Example: Example p { color:#0000FF; }

External Style Sheets An external stylesheet contains styles that are defined in another documentexternal stylesheet There are three types of external stylesheets Permanent Define HREF, REL and TYPE attributes REL="stylesheet" Persistent Define HREF, REL, TYPE and TITLE attributes REL="stylesheet" Alternate Define HREF, REL, TYPE and TITLE attributes REL="alternate stylesheet"

External Stylesheets External sheets are typically given the filename extension.CSS External sheets are typically placed in a stylesheet subdirectory

The DIV Element The DIV is an HTML element containerDIV Holds child elements Where flow content is expected Content is flow content Operates at the block level Can be used to apply styles to all DIV children

The SPAN Element A SPAN is an HTML element containerSPAN Holds child elements Where phrasing content is expected Content is phrasing content Operates at the inline level Can be used to apply styles to all SPAN children

DIV Versus SPAN DIV operates on flow (block) content. SPAN operates on phrasing (inline) content. Apply DIV and SPAN on a paragraph and you will see the difference. DIV must go outside P (DIV is flow content) SPAN must go inside P (SPAN is phrasing content).

Selectors A selector determines what HTML elements are affected by the list of style rules in a styleselector There are many types of selectors Type selectors Group selectors Universal selectors

Type Selectors A type selector specifies a specific HTML element as the selectortype selector Example: p { font-size:24px; }

Group Selectors A group selector specifies a comma-separated list of HTML elements as the selectorgroup selector Example: p, pre, code, a { font-size:24px; }

Universal Selectors A universal selector specifies all HTML elements as the selectoruniversal selector Example: * { font-size:24px; }

Descendant Selectors A descendant selector specifies a nested HTML element as the selectordescendant selector All parents and the child for whom the style is to be applied must be listed in order of appearance, in a space-separated list Examples: p { font-size:12px; } p b { font-size:24px; } p b b { font-size:36px; }

Child Selectors A child selector specifies a parent and direct child HTML element as the selectorchild selector The style is applied to the child element Examples: body > p { color:#FF0000; }

Adjacent Sibling Selectors An adjacent sibling selector specifies an HTML element and direct neighbor HTML element (they have the same parent) as the selectoradjacent sibling selector The style is applied to the neighboring element Examples: b + i { color:#FF0000; } This is bold. This is italic. Which one will be red? The italic one of course!

Class Selectors An optional HTML element, followed by a period, then followed by a class name, defines a class selector class selector The style is applied to any HTML element where you specify the attribute CLASS = classname Examples:.blueText { color:#000077; } p.greenText { color:#007700; } Yo! This is blue!

Fonts font-family font-size font-style font-variant font-weight font

Text text-align text-decoration text-indent text-transform letter-spacing word-spacing white-space