CSS The Definitive Guide Chapter 2 & Review of some things in HTML5.

Slides:



Advertisements
Similar presentations
Introduction to HTML & CSS
Advertisements

HIGH LEVEL OVERVIEW: CSS CSS SYNTAX CONSISTS OF A SET OF RULES THAT HAVE 3 PARTS: A SELECTOR, A PROPERTY, AND A VALUE. IT’S NOT NECESSARY TO REMEMBER THIS.
Intro To Cascading Style Sheets By Mario Yannakakis.
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
Today CSS HTML A project.
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.
Chapter 3 – Designing your web pages Dr. Stephanos Mavromoustakos.
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.
© 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.
1 Pengantar Teknologi Internet W03: CSS Cascading Style Sheets.
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.
Chapter 8 Creating Style Sheets.
Chapter 6 Web Typography
4.01 Cascading Style Sheets
Using Cascading Style Sheets (CSS) Dept. of Computer Science and Computer Information CSCI N-100.
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.
 Missing (or duplicate) semicolons can make the browser completely ignore the style rule.  You may add extra spaces between the properties/values to.
Review HTML  What is HTML?  HTML is a language for describing web pages.  HTML stands for Hyper Text Markup Language  HTML is not a programming language,
Principles of Web Design 6 th Edition Chapter 4 – Cascading Style Sheets.
Chapter 11 Cascading Style Sheets: Part I The Web Warrior Guide to Web Design Technologies.
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.
Cascading Style Sheets (CSS) 1.  What is CSS?  Why CSS?  How to write a CSS? 2.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 3 Key Concepts 1 Copyright © Terry Felke-Morris.
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.
INTRODUCTION TO HTML5 CSS Styles. Understanding Style Sheets  HTML5 enables you to define many different types of content on a web page, including headings,
Today’s objectives  Presentational | Inline | Block | Validate  CSS | Rules | Declarations.
Chapter 12 Cascading Style Sheets: Part II The Web Warrior Guide to Web Design Technologies.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 7 TH EDITION Chapter 3 Key Concepts 1 Copyright © Terry Felke-Morris.
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.
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.
Cascading Style Sheets Orientation Learning Web Design: Chapter 11.
INTRODUCTION TO CSS. OBJECTIVES: D EFINE WHAT CSS IS. K NOW THE HISTORY OF CSS. K NOW THE REASON WHY CSS IS USED. CSS SYNTAX. CSS ID AND CLASS.
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.
Css. Definition Cascading style sheet (CSS)  It is a simple mechanism for adding style (e.g. fonts, colors, spacing) to Web documents.
Using the CSS. What is CSS? CSS is a language that’s used to define the formatting applied to a Website, including colors, background images, typefaces.
Chapter 6 Introducing Cascading Style Sheets Principles of Web Design, 4 th Edition.
INTRODUCTION TO CSS. TOPICS TO BE DISCUSSED……….  Introduction Introduction  Features of CSS Features of CSS  Creating Style Sheet Creating Style Sheet.
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.
LEARN THE QUICK AND EASY WAY! VISUAL QUICKSTART GUIDE HTML and CSS 8th Edition Chapter 8: Working with Style Sheets.
CS 174: Web Programming September 9 Class Meeting Department of Computer Science San Jose State University Fall 2015 Instructor: Ron Mak
XHTML Formatting font with a style declaration. Formatting Font HTML uses the font tag to change size and family of font But… the font tag is being deprecated.
Web Design (12) CSS Introduction. Cascading Style Sheets - Defined CSS is the W3C standard for defining the presentation of documents written in HTML.
Microsoft Expression Web 3 – Illustrated Unit D: Structuring and Styling Text.
Web Technologies Beginning Cascading Style Sheets (CSS) 1Copyright © Texas Education Agency, All rights reserved.
CSS Syntax. Syntax The CSS syntax is made up of three parts: a selector, a property and a value: selector {property: value}
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.
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 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.
4.01 Cascading Style Sheets
>> Introduction to CSS
Madam Hazwani binti Rahmat
Cascading Style Sheets (Layout)
Intro to CSS CS 1150 Fall 2016.
IS333: MULTI-TIER APPLICATION DEVELOPMENT
Website Design 3
Cascading Style Sheets - Building a stylesheet
What are Cascading Stylesheets (CSS)?
Cascading Style Sheets
Cascading Style Sheets - Building a stylesheet
4.01 Cascading Style Sheets
Presentation transcript:

CSS The Definitive Guide Chapter 2 & Review of some things in HTML5

 CSS allows rules that are simple to change, edit and apply. Example: h2 {color: gray;} By editing a single line of CSS you can change to colors of all your headings… Lets you the designer focus on the design!

 Look at page 24 ◦ Two fundamental parts: Selector ~ Defines which part of the document will be affected. And is on the left side Declaration ~ Found on the rights side and can contain a combination of CSS property and a value. Examples of elements of an HTML document: P, h3, em, a, h1, h2, h4, etc….

 Can contain one or more declarations  Always formatted as a property followed by a colon and then a value followed by a semicolon. ◦ p {font: medium Helvetica;} ◦ Remember~  the semicolon ; indicates that the declaration has been concluded.  Keywords are separated by a space, taken together they form the value of the property.

The most common criterion for choosing which elements to format is the element’s name or type. As an example you may want to make all h2 elements red. h2 { color: red; } The above is the style for that to happen. The above style is saved to name.css

Antoni Gaudí - Introduction name.css Antoni Gaudí Many tourists are drawn to Barcelona to see Antoni Gaudí's incredible architecture. Barcelona celebrated the 150th anniversary of Gaudí's birth in La Casa Milà Gaudí's work was essentially useful. La Casa Milà is an apartment building and real people live there. La Sagrada Família The complicatedly named and curiously unfinished Expiatory Temple of the Sacred Family is the most visited building in Barcelona.

Antoni Gaudí Many tourists are drawn to Barcelona to see Antoni Gaudí's incredible architecture. Barcelona celebrated the 150th anniversary of Gaudí's birth in 2002.celebrated the 150th anniversary La Casa Milà Gaudí's work was essentially useful. La Casa Milà is an apartment building and real people live there. La Sagrada Família The complicatedly named and curiously unfinished Expiatory Temple of the Sacred Family is the most visited building in Barcelona. (h2 shows up red)

Not all selectors need to specify an element’s name. If you want to apply formatting to an entire class of elements, regardless of which type of elements have been identified with that class, you’d want to leave the name out of the selector. Also you can choose a group of element names for a selector by using a comma to separate them.

 Lets look at a HTML5 document and the CSS that is applied using class.document

 Separated by spaces  CSS property font is the exception. ◦ Here a forward slash (/) is used to separate two specific keywords. ◦ Example:  H2 {font: large/150% sans-serif;}  The slash separates the keywords that set the element’s font size and line height. This is the only place the slash is allowed to appear in the font declaration.

 You can group selectors!  By placing multiple selectors on the left side of the rule and separating them with a comma, you can have the style on the right effect the multiple selectors given.  Example: ◦ h2, p {color: gray;}

 There is no limit on how many selectors you can group together.  Allows for compacting certain types of style assignments which makes for a shorter style sheet.  Universal selector is displayed as an asterisk * ◦ Example ~ *{color; red;} would make every single element in a document red

 Using semi colons at the end of each declaration is crucial when grouping.  Browsers ignore whitespace in style sheets Example: h1 {font; 18px Helvetica; color: purple; background: aqua;} Or H1 { font: 18px Helvetica; color: purple; background; aqua; }

 Allow you to assign styles in a way that is independent of document elements.  To use them takes planning  Using class selectors is the most common way to apply styles without worrying about the elements involved.  So remember in your html document you need to mark it up so class selectors will work.

Let’s look at the codethe code Below is class.css.about { color: red; }  To select elements to format based on their class: 1. Type. (that is a period) 2. With no intervening space, immediately type classname, where classname identifies the class to which you’d like to apply the styles.

1. Type # (a hash or pound sign) 2. With no intervening space, immediately type id, where id uniquely identifies the element to which you’d like to apply the styles.

.news {color: red; } would effect all elements with the news class, while h1.news {color: red;} would affect only the h1 elements with the news class.

If the css was written instead as #gaudi {color: red;}, only the text in the first article would be red, because it’s the only one with id=“gaudi”. Each id must be unique, so you can’t reuse that id on the article about Luis Domenech I Montaner. Let’s look

The name of the class was about which conveys the meaning of the content to which it’s applied rather than calling it red. It’s best to avoid creating a class name that describes how something looks, because you might change the styles later, like making the text green in this case. Classes add semantic value to your HTML5 like elements do.

 It is recommended to use classes whenever possible, because you can reuse them. But ultimately it is your choice.  Two issues that ID Selectors have: ◦ Their associated styles can’t be reused on other elements. An ID may appear on only one element in a page ◦ They are more specific than class selectors. This means if you ever need to override styling that was defined with an id selector, you’ll need to write a CSS rule that’s even more specific.

The CSS would be: p:first-line { color: red; } The first line in every paragraph would be red.

You can also select just the first letter or first line of an element and then apply formatting to that. Antoni Gaudí Many tourists are drawn to Barcelona to see Antoni Gaudí's incredible architecture. Barcelona celebrated the 150th anniversary of Gaudí's birth incelebrated the 150th anniversary La Casa Milà Gaudí's work was essentially useful. La Casa Milà is an apartment building and real people live there. La Sagrada Família The complicatedly named and curiously unfinished Expiatory Temple of the Sacred Family is the most visited building in Barcelona.

HTML5 first letter CSS document for the above HTML5 p:first-letter { color: red; }

 In CSS, you can pinpoint elements depending on their ancestors, their parents, or their siblings.  An ancestor is any element that contains the desired element regardless of the number of generations that separate them.

Review

Chapter 2: Creating and Editing a Web Page Using Inline Styles26

Chapter 2: Creating and Editing a Web Page Using Inline Styles27

Chapter 3: Creating Web Pages with Links, Images, and Embedded Style Sheets28

 Content placed in a footer generally has to do with the company’s address, copyright, or contact information Chapter 2: Creating and Editing a Web Page Using Inline Styles30

Chapter 2: Creating and Editing a Web Page Using Inline Styles31

Chapter 2: Creating and Editing a Web Page Using Inline Styles32

Chapter 3: Creating Web Pages with Links, Images, and Embedded Style Sheets33

Chapter 2: Creating and Editing a Web Page Using Inline Styles34

Chapter 2: Creating and Editing a Web Page Using Inline Styles35

 Please update your styles with groupings.  You must provide three groupings somewhere in your code. 1)Group selectors 2)Group declarations 3)Universal selector  Please provide an additional information page explaining Class selectors and ID selectors ◦ Must provide content for this additional page ◦ On this page please provide a CSS page that will make the first letter a different color. ◦ Please include one CSS using print media. I will be viewing it in Print preview to determine if you were successful.  Also please use the HTML5 elements we have discussed in class so far on each page.