Cascading Style Sheets CSS. What is it? Another file format ! its not like html Describes the looks of “selectors” in a.css file (example.css) in the.

Slides:



Advertisements
Similar presentations
Cascading Style Sheets
Advertisements

HTML Basics Customizing your site using the basics of HTML.
Table, List, Blocks, Inline Style
CSS Cascading Style Sheets. Objectives Using Inline Styles Working with Selectors Using Embedded Styles Using an External Style Sheet Applying a Style.
1 Cascading Style Sheets Continued Different kinds of selectors in a style sheet –Simple- Pseudo-Class –Contextual- Pseudo-Element –Class Image Styles.
Cascading Style Sheets
Cascading Style Sheets
CSS The basics { }. CSS Cascading Style Sheets - language used to – describe html appearance & formatting Style Sheet - file that describes – how html.
Cascading Style Sheets: Basics I450 Technology Seminar Copyright 2003, Matt Hottell.
Introducing CSS CIS 133 mashup Javascript, jQuery and XML 1.
CHAPTER 8 ADVANCED CSS. LEARNING OBJECTIVES Assign formatting styles to a CSS class definition Use a tag’s class attribute to apply the styles defined.
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.
Today’s objectives  Element relations – tree structure  Pseudo classes  Pseudo elements.
CSS cont. October 5, Unit 4. Padding We can add borders around the elements of our pages To increase the space between the content and the border, use.
© 2004, Robert K. Moniot Chapter 6 CSS : Cascading Style Sheets.
1 Web Developer & Design Foundations with XHTML Chapter 9 Key Concepts.
CSS BASICS. CSS Rules Components of a CSS Rule  Selector: Part of the rule that targets an element to be styled  Declaration: Two or more parts: a.
Building a Website: Cascading Style Sheets (CSS) Fall 2013.
Cascading Style Sheets Based on Castro, HTML for the WWW, 6 th edition Ron Gerton, Fall 2007.
1 Pengantar Teknologi Internet W03: CSS Cascading Style Sheets.
CIS 1310 – HTML & CSS 6 Layout. CIS 1310 – HTML & CSS Learning Outcomes  Describe & Apply the CSS Box Model  Configure Float with CSS  Designate Positioning.
Recognizing the Benefits of Using CSS 1. The Evolution of CSS CSS was developed to standardize display information CSS was slow to be supported by browsers.
CSW131 Steven Battilana 1 CSW 131 – Chapter 5 (More) Advanced CSS Prepared by Prof. B. for use with Teach Yourself Visually Web Design by Ron Huddleston,
Web Pages and Style Sheets Bert Wachsmuth. HTML versus XHTML XHTML is a stricter version of HTML: HTML + stricter rules = XHTML. XHTML Rule violations:
“Cascading Style Sheets” for styling WWW information DSC340 Mike Pangburn.
กระบวนวิชา 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.
Chapter 8 Creating Style Sheets.
CSS normally control the html elements. Three Ways to Insert CSS There are three ways of inserting a style sheet: External style sheet Internal style.
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.
Ch. 5 Web Page Design – Templates and Style Sheets Mr. Ursone.
 Missing (or duplicate) semicolons can make the browser completely ignore the style rule.  You may add extra spaces between the properties/values to.
Week 4.  Three ways to apply CSS: Inline CSS Internal style sheets ( header style information) External style sheets.
CSS Cascading Style Sheets By Garrett Garman. CSS Why use Style Sheets? Separates Appearance and Structure Modularity Quick and Easy changes Flexibility.
Cascading Style Sheets CSS.  Standard defined by the W3C  CSS1 (released 1996) 50 properties  CSS2 (released 1998) 150 properties (positioning)  CSS3.
MORE Cascading Style Sheets (The Positioning Model)
XP New Perspectives on XML Tutorial 5 1 TUTORIAL 5 CSS Tutorial – Carey ISBN
Cascading Style Sheets by Pavlovic Nenad by. Presentation Contents  What is CSS?  Why CSS?  Types of Style Sheets  Style Sheets Syntax  Box Formatting.
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.
CSS Tutorial 1 Introduction Syntax How to use style specifications. Styles.
Intro To Web Design with Adobe Dreamweaver CSS Cascading Style Sheets (CSS) is the W3C standard for defining the presentation of documents written in HTML,
ECA225 Applied Interactive Programming Cascading Style Sheets, pt 1 ECA 225 Applied Online Programming.
So far, we have looked at CSS selectors that correlate with HTML tags Now, we’ll see how you can define your own selectors using class and ID selectors.
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 CSS.  Standard defined by the W3C  CSS1 (released 1996) 50 properties  CSS2 (released 1998) 150 properties (positioning)  CSS3.
XP Review 2 New Perspectives on JavaScript, Comprehensive1 Introducing Cascading Style Sheets Formatting Web Pages with CSS.
Developing Web Applications with HTML and CSS “Selectors and Properties”
Cascading Style Sheets CSS2 - a bit more advanced.
CSS FOUNDATIONS IN-DEPTH The nitty-gritty of css...
Cascading Style Sheets - CSS basics. CSS use in html Internally … …css… … Externally.
ECA 228 Internet/Intranet Design I Cascading Style Sheets.
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…
IS 360 Understanding CSS Selectors. Slide 2 Types of Selectors There are different types of selectors Each has a different level of “specificity” An element.
1 Cascading Style Sheets
Introduction to CSS: Selectors
CSS.
Cascading Style Sheets
CSS for Styling By Jinzhu Gao.
IS 360 Declaring CSS Styles
CSS Intro.
IS333: MULTI-TIER APPLICATION DEVELOPMENT
Cascading Style Sheets - Building a stylesheet
Software Engineering for Internet Applications
IS 360 Understanding CSS Selectors
The Internet 10/6/11 Cascading Style Sheets
Cascading Style Sheets
Tutorial 3 Working with Cascading Style Sheets
Cascading Style Sheets - Building a stylesheet
Introduction to Cascading Style Sheets (CSS)
Presentation transcript:

Cascading Style Sheets CSS

What is it? Another file format ! its not like html Describes the looks of “selectors” in a.css file (example.css) in the of html in the tag in the style attribute of almost any html tag (style=””)

Why ANOTHER format? Conceptual History Purpose more flexible than html works like a tree...

Styles The basic idea: Classify text by its appearance give common classifications a name use the name to refer to them and apply attributes to them, such as type size

CSS Concept Documents are formatted based on the meaning Assign the look for a meaning not the content! CSS is used outside HTML too! Concept is from the Publishing World

Style Sheets “Styles” or Style sheets are commonplace in publishing software Print industry used Style Sheets to streamline workflow A “Style” is shorthand for a set of attributes, such as typeface (font,) size, spacing, kerning

Cascading Style Sheets Used in computer style sheets for publishing software (initially) Vague incomplete styles could allow another style’s attributes to be used Allow more complex mixing of styles Saves work, you don’t have to create a new style for each minor variation

Inheritance Styles based upon existing styles NOT directly in CSS, but some software (Adobe PageMaker) it is Essentially, it is an automated “dynamic” template system COPY some style’s attributes then add & override new attributes

Inheritance When a conflict occurs, the child wins Tree structure, similar to a family tree- properties are passed down; “inherited” red parent + bold child = red & bold child red parent + green child = green child

Cascading a “Cascade” of style attributes passes on down the tree to the decedents Style is calculated based on the child’s position in the whole family tree The resulting style does not exist as a “style” but as a mix of all the other styles above it in the tree

Cascade vs Inherit +=

Selectors terminology to remember! Selectors “select” items on the page such as: all H1 tags & all H2 tags 1 tag with the ID “fred” all tags classified “cats”

CSS use in html Internally … …css… … Externally

Selectors = What/how to “select” the tags you want to apply style attributes to 3 CSS Selectors tagname (aka element name).classname (class attribute) #idname (id attribute) 3 ways to apply a style

SillyPhrase Animal The fox jumped over the lazy dog

Selectors: (3 ways to apply a style) IDs - can only be used ONCE per HTML file Class - can be used many times tag - all tag, so all tags could be made italic! SillyPhrase Animal The fox jumped over the lazy dog

Attribute / Property list is similar to Java/C/JavaScript in syntax Selector {property: value;} is a tagname, #idname, or.classname /* block comments */ Selector1 selector2 selector3 {…} CSS Syntax

The fox jumped over the lazy dog SillyPhrase Animal The fox jumped over the lazy dog.animal { color: black;font-weight: bold;} #sillyphrase { color: gray; }

SillyPhrase Animal The fox jumped over the lazy dog.animals is applied to everything that has the class= “animals” #sillyphase could be made RED, and then the fox and dog (animals) would inherit the RED color.animals are black, no matter what color #sillyphrase is The fox jumped over the lazy dog

Typical use classes are the most flexible often multiple situations are used:.classname h1 {…} class “.classname” can have any number of tags or classes inside the tag-- inside one of those an will still match

Backgrounds background-color: #ff00ff background-image: url( ) background-repeat: repeat-x, repeat- y, repeat, no-repeat, inherit background-position: x y; background-attachment: scroll, fixed

Relative Units Save YOU time long-term % percentage of available size em 1= size of 1 (one) line of parent’s text ex 1= half of em = 0.5 em

example h1{ font-size: 0.5em; } will be HALF the size of whatever the parent’s font size is works on everything; but is text height based

pseudo-class selectors selector:pseudoClass used for generic situations and events :link :visited :hover :active :focus :first-child :lang etc a:visited anchor tags the user clicked on before

text pseudo-element selectors :before = before the content :after = after the content {content: “text”} = lets you insert text! :first-letter :first-line

event pseudo-element selectors :visited (visited anchor link) :active (working anchor link) :hover (mouse over) :focus (forms)

Example.myclass:hover the pseudo-class is PART of the selector this example is also a “trick” The 1 st selector’s :hover event will still find the 2 nd selector and change those! A mouse over a parent could change just the children (the 2 nd selector)

Example.myclass:hover the pseudo-class is PART of the selector this example is also a “trick” The 1 st selector’s :hover event will still find the 2 nd selector and change those! A mouse over a parent could change just the children (the 2 nd selector)

See the example CSS web page on the class website. Use CSS references / tools Most HTML tags come with built-in properties, which you can override with CSS, like making Use LIVE CSS editor to learn (Firefox) Next…