Smashing ~ Chapter 2.  Why are they so important? ◦ Without them we would have no way of assigning styles to elements. ◦ By using selectors we can accomplish.

Slides:



Advertisements
Similar presentations
Intro to HTML. HTML HTML = HyperText Markup Language Used to define the content of a webpage HTML is made up of tags and attributes Content.
Advertisements

CSS-Formatting Review Cascading Style Sheets addstyle to your HTML web pages.
CSS Cascading Style Sheets. Objectives Using Inline Styles Working with Selectors Using Embedded Styles Using an External Style Sheet Applying a Style.
Web Pages Week 10 This week: CSS Next week: CSS – Part 2.
Cascading Style Sheets
HTML Overview - Cascading Style Sheets (CSS). Before We Begin Make a copy of one of your HTML file you have previously created Make a copy of one of your.
CHAPTER 7 STYLING CONTENT WITH CASCADING STYLE SHEETS.
Introducing CSS CIS 133 mashup Javascript, jQuery and XML 1.
Making Things Look Nice: Visual Appearance and CSS CMPT 281.
Chapter 3 – Designing your web pages Dr. Stephanos Mavromoustakos.
Some SpotLight in CSS. CSS element>element Selector div>p.
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.
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.
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.
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.
LEARN THE QUICK AND EASY WAY! VISUAL QUICKSTART GUIDE HTML and CSS 8th Edition Chapter 9: Defining Selectors.
กระบวนวิชา 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 Workshop: CSS Objectives: - “What is CSS?” - Structure of CSS - How to use CSS in your webpage.
XP 1 Working with Cascading Style Sheets Creating a Style for Online Scrapbooks Tutorial 7.
4.01 Cascading Style Sheets
Working with Cascading Style Sheets. 2 Objectives Introducing Cascading Style Sheets Using Inline Styles Using Embedded Styles Using an External Style.
CSS (Cascading Style Sheets): How the web is styled Create Rules that specify how the content of an HTML Element should appear. CSS controls how your web.
Principles of Web Design 6 th Edition Chapter 4 – Cascading Style Sheets.
Working with Cascading Style Sheets. Introducing Cascading Style Sheets Style sheets are files or forms that describe the layout and appearance of a document.
Chapter 11 Cascading Style Sheets: Part I The Web Warrior Guide to Web Design Technologies.
XP Tutorial 7New Perspectives on Creating Web Pages with HTML, XHTML, and XML 1 Working with Cascading Style Sheets Creating a Style for Online Scrapbooks.
CSS Style Rules Guang Tong, Zhan L;lo’p[ Css Style Rule Guang Tong Zhan Three ways to insert CSS 1 External style sheet 2 Internal style sheet 3 Inline.
Review: Three parts to a webpage: - Content - Structure  XHTML - Presentation  CSS In this chapter we will focus on introducing and examining the mechanics.
Dreamweaver -- CSS. Dreamweaver -- MX New icons are added in MX Most of the features commonly used in web design, and are same as FrontPage. New feature.
Week 4.  Three ways to apply CSS: Inline CSS Internal style sheets ( header style information) External style sheets.
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)
Cascading Style Sheets by Pavlovic Nenad by. Presentation Contents  What is CSS?  Why CSS?  Types of Style Sheets  Style Sheets Syntax  Box Formatting.
Today’s objectives  Review  CSS | Rules | Declarations  HTML Structure document  Class asignment.
ITCS373: Internet Technology Week 3: Introduction to CSS Dr. Faisal Al-Qaed.
Introduction To CSS.. HTML Review What is HTML used for? Give some examples of formatting tags in HTML? HTML is the most widely used language on the Web.
 This presentation introduces the following: › 3 types of CSS › CSS syntax › CSS comments › CSS and color › The box model.
CIS 1315 – Web Development for Educators CIS 1315 HTML Tutorials 3 & 4: Working With CSS.
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.
Cascading Style Sheets Orientation Learning Web Design: Chapter 11.
Working with Cascading Style Sheets (CSS) Module 2: HTML Basics LESSON 5.
 cascade Style Sheets (CSS) is a mark-up language that was first proposed in 1994 by Håkon Wium Lie. CSS works in conjunction with HTML to greatly increase.
Introduction to Programming the WWW I CMSC Winter 2003 Lecture 7.
Cascading Style Sheets Part 1. CSS vs HTML HTML: Originally intended to markup structure of a document (,...,,,,,...) CSS Developing technology, CSS1,
Chapter 6 Introducing Cascading Style Sheets Principles of Web Design, 4 th Edition.
>> The “Box” Model. Pre-requisite Create a new project in Netbeans called Week5 Create a new html file and name it box.html Create a new css file and.
CSS Class 2 -Add margins to elements on a page. -Set width and height of elements. - CSS shorthand properties for box model. -Style links. -Style tables.
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.
DIV, Span, CSS.
Cascading Style Sheets CSS.  Standard defined by the W3C  CSS1 (released 1996) 50 properties  CSS2 (released 1998) 150 properties (positioning)  CSS3.
HTML with Style!. What is a Style Sheet? CSS? Style Sheet CSSCascading Style Sheets A “language” for defining style rules. Rules that tell the browser.
CNIT 132 – Week 4 Cascading Style Sheets. Introducing Cascading Style Sheets Style sheets are files or forms that describe the layout and appearance of.
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.
Cascading Style Sheets CSS2 - a bit more advanced.
INTRODUCING CSS What CSS does How CSS works Rules, properties, and values.
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.
CH 12 CSS Style Sheets 1. Objective What is CSS? Selecting elements Different rules for different media Importing style sheets 2.
CSS Layout Cascading Style Sheets. Lesson Overview  In this lesson, we’ll cover:  Brief CSS review  Creating sections with the tag  Creating inline.
Chapter 4 Frames and Cascading Style Sheets. Frames Frames divide a browser window into two or more separate pieces or panes, with each pane containing.
Links All CSS properties can be applied on links (i.e. change colors, fonts, underline, etc). The new thing is that CSS allows you to define these properties.
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.
Intro to CSS CS 1150 Fall 2016.
Website Design 3
Intro to CSS CS 1150 Spring 2017.
IS 360 Understanding CSS Selectors
Presentation transcript:

Smashing ~ Chapter 2

 Why are they so important? ◦ Without them we would have no way of assigning styles to elements. ◦ By using selectors we can accomplish a great deal of styling with just a few lines of CSS.

 There are two types of pseudo things: 1)There are psuedo-classes A pseudo-class is similar to a class in HTML, but it’s not specified explicitly in the markup. Some pseudo-classes are dynamic—they’re applied as a result of user interaction with the document.

 A pseudo-class starts with a colon (:). No whitespace may appear between a type selector or universal selector and the colon, nor can whitespace appear after the colon.  They are better supported by browsers therefore more widely used.

 :link: An Unvisited link  :visited: A visited link  :hover: A hovered element  :focus: A focused element  :active: An active element (such as a link while it’s being clicked)  :first-child: An element that is the first child of another element  :lang(): An element based on the value of its lang attribute

 ::first-line  ::first-letter  ::before  ::after

p:first-child { color:blue; } This is some text. Typing more information in the paragraph may make more sense sometimes. Since this is the first paragraph within the body element you could say that it is the first child. This is some text. Hello I came after the first paragraph. I am the second paragraph therefor you could say I am the second child. Wow! Where do I fit in? I know I am not the first child! Note: For :first-child to work in IE8 and earlier, a DOCTYPE must be declared.

This is some text. Typing more information in the paragraph may make more sense sometimes. Since this is the first paragraph within the body element you could say that it is the first child. This is some text. Hello I came after the first paragraph. I am the second paragraph therefore you could say I am the second child. Wow! Where do I fit in? I know I am not the first child! Note: For :first-child to work in IE8 and earlier, a DOCTYPE must be declared.

p > i:first-child { color:blue; } I am a strong man. I am a strong man. Note: For :first-child to work in IE8 and earlier, a DOCTYPE must be declared.

I am a strong man. Note: For :first-child to work in IE8 and earlier, a DOCTYPE must be declared.

  input:focus  {  background-color:yellow;  }   Click inside the text fields to see a yellow background:   First name:  Last name:   Note: For :focus to work in IE8, a DOCTYPE must be declared. 

Click inside the text fields to see a yellow background: First name: Last name: Note: For :focus to work in IE8, a DOCTYPE must be declared.

selector inserts content before the content of the selected element(s). Use the content property to specify the content to insert. p:before { content:"Read this: "; }

p::before { content:"Read this -"; } My name is Pam Kouris. I am here tonight teaching at Oakton. The room number is It is a lab! Note: For :before to work in IE8, a DOCTYPE must be declared.

Read this – My name is Pam Kouris. I am here tonight teaching at Oakton. Read this -The room number is It is a lab! NOTE: For :before to work in IE8, a DOCTYPE must be declared.

:: double colon syntax was introduced in CSS2.1 As of this date, no browser requires that you use the double-colons before pseudo-elements. A single element works fine.

CSS3 adds the pseudo-classes – The list can be found on page 41 in Smashing text. (Most are not widely supported at this time)

It might be useful to be very specific when providing a link to certain information. The fragment identifier is #sec2.7 Text used :target to provide a visual cue to show that you in fact have gone there.

 Refers to the rules behind why a browser would choose one style over another when displaying an element.  Becomes more important the more complicated your site gets.  Is the numeric representation of the “specificness” of a selector.

 The order in which styles are read by the browser matters  If there was a case of two styles affecting the same selector, the last property to be read would be the one that would apply. In this example: p {color: blue;} p{color: yellow;} All paragraphs would be yellow.

 This is true whether the styles are in the same style sheet or in a different external style sheets. The style that is read last would be the one that is applied!  If you are getting styles from different locations, the order of the styles is important.

URL ("stylesheet3.css"); p { color: blue; } first paragraph...

 The fifth style sheet is the most specific and so it would be applied.  Even though there are other styles in another style sheet that would apply, the fifth one would be the one the browser would apply.

 Order is not the only thing that defines how a style gets applied.  The more specific your style is defined the more likely it will be applied.

 Assign specificity to a style: 1) Count the number of element names in the selector 2) Count the number of psuedo-classes and other non-ID attributes in the selector and multiply by 10 3) Count the number of ID attributes in the selector, and multiply by 100 4) Add up all three numbers, this = that property’s specificity.

Importance overrides specificity and that is !important It is a way in CSS to make a rule that you feel are most crucial always be applied. A rule that has the !important will always be applied no matter where the rule appears in the CSS document. Example: If you wanted the paragraph text to always be red p {color: red !important; } p {color: yellow;}

 Shorthand properties let you specify several properties by using only one. CSS shorthand makes it easier for you to apply style to your markup and makes your CSS code more concise.  Any missing key shorthand properties left off the browser will then use the default values.

body { background: url("bg.gif"); background-color: #fff; background-repeat: repeat-x; } Using a shortcut: body { background: url("bg.gif") #fff repeat-x; }

 You will be working in teams: ◦ Team 1 = Mike and Laura ◦ Team 2 = Marcel and Rami and Eric ◦ Team 3 = Andrew and Sylvia and Nick