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.

Slides:



Advertisements
Similar presentations
1 © Netskills Quality Internet Training, University of Newcastle Introducing Cascading Style Sheets © Netskills, Quality Internet.
Advertisements

Table, List, Blocks, Inline Style
HTML and CSS. HTML Hyper Text Markup Language Tells browser how to display text and images.
CSS-Formatting Review Cascading Style Sheets addstyle to your HTML web pages.
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. Next Level Cascading Style Sheets (CSS) - control the look and feel of your HTML documents in an organized and efficient manner.
CSS. CSS stands for Cascading Style Sheets Styles define how to display HTML elements Styles were added to HTML 4.0 to solve a problem External Style.
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.
Cascading Style Sheets (CSS) “Styles” for short. Pg. 418.
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.
Introducing CSS CIS 133 mashup Javascript, jQuery and XML 1.
CSS. Intro to CSS Cascading Style Sheets – styles and enhances appearance of webpage.css extension.
Making Things Look Nice: Visual Appearance and CSS CMPT 281.
Introduction to CSS.
Very quick intro HTML and CSS. Sample html A Web Title.
FORMATTING IN CONTEXT. FOLLOW UPS ANCHOR POINTS MUST BE UNIQUE  If you have more than one, how does it know where to go?  They can be repeated across.
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.
HyperText Markup Language (HTML) Uses plain text to add markup instructions to a file. If you can't produce it with a standard keyboard, it can't go into.
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.
Cascading Style Sheets By: Valerie Kuna. What are Cascading Style Sheets? Cascading Style Sheets (CSS) are a standard for specifying the presentation.
© 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.
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,
“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.
Cascading Style Sheets Scripting with Style. CSS versus HTML  Ways to format in HTML –HTML Tag extensions –Converting Text to images –Page Layout with.
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.
Principles of Web Design 6 th Edition Chapter 4 – Cascading Style Sheets.
Week 4.  Three ways to apply CSS: Inline CSS Internal style sheets ( header style information) External style sheets.
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.
1 CSC 121 Computers and Scientific Thinking David Reed Creighton University HTML and Web Pages.
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.
Cascading Style Sheets by Pavlovic Nenad by. Presentation Contents  What is CSS?  Why CSS?  Types of Style Sheets  Style Sheets Syntax  Box Formatting.
(CSS) More Details Instructor: Mr. Ahmed Al Astal ITGD4104 Department Requirement for senior student University of Palestine Faculty of IT.
ITCS373: Internet Technology Week 3: Introduction to CSS Dr. Faisal Al-Qaed.
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.
CO1552 – Web Application Development Cascading Style Sheets.
Cascade Style Sheet Introduction. What is CSS?  CSS stands for Cascading Style Sheets  Styles define how to display HTML elements  Styles were added.
Chapter 6 Introducing Cascading Style Sheets Principles of Web Design, 4 th Edition.
Cascading Style Sheets CSS.  Standard defined by the W3C  CSS1 (released 1996) 50 properties  CSS2 (released 1998) 150 properties (positioning)  CSS3.
CSS: Cascading Style Sheets Part II. Style Syntax.
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.
WEB FOUNDATIONS CSS Overview. Outline  What is CSS  What does it do  Where are styles stored  Why use them  What is the cascade effect  CSS Syntax.
WebD Introduction to CSS By Manik Rastogi.
Creating Your Own Webpage
Introduction to CSS.
Madam Hazwani binti Rahmat
Cascading Style Sheets contd: Embedded Styles
IS333: MULTI-TIER APPLICATION DEVELOPMENT
Introduction to CSS.
Software Engineering for Internet Applications
What are Cascading Stylesheets (CSS)?
Cascading Style Sheets
Web Development & Design Foundations with H T M L 5
Web Design and Development
Presentation transcript:

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 by one more classes to the tag’s contents Specify multiple selectors within a class definition to direct the browser to apply the styles to multiple tags Create a selector-specific class definition that applies only to the specified tag Assign CSS formatting styles to a name (an identifier), which can later be assigned to one specific HTML element based on the element’s id attribute. Apply CSS styles to predefined pseudo classes and pseudo elements

REVIEWING INLINE STYLES Famous Quotes Abraham Lincoln Always bear in mind that your own resolution to succeed, is more important than any other one thing.

GETTING STARTED WITH CSS CLASSES Often, there will be times when you will want to display a tag’s contents differently based on the tag’s context or use. For example, you might want to display your first paragraph with a bold font, a paragraph that contains a quote in italics, and yet other paragraphs in a standard font. In such cases, you can use CSS classes to define the formatting for each “class” of paragraph. To define a CSS class, you specify a class name, which you define, and the corresponding attributes. You will precede the class name with a period and then place the class attributes within left and right braces:.classname { attributes here }

USING A CLASS DEFINITION After you define a class, you use the class attribute within a tag to specify the name of the class the attributes of which you want to include. The following statement, for example, uses the class attribute within the tag to apply the styles defined by the quote class: Text here

CSS CLASS DEMO.bold { font-weight:bold; }.quote { font-style:italic; } This text is normal. Albert Einstein A person who never made a mistake never tried anything new.

STYLING A TABLE.odd { background-color:orange; }.even { background-color:yellow; }

ASSIGNING DEFINITIONS TO MULTIPLE SELECTORS Often, as you format a page, you will use the same attributes for many elements, such as font or color: h1 { font-family:arial; color:blue; } h2 { font-family:arial; color:blue; } p { font-family:arial; color:blue; } In such cases, you can specify the tag selectors on one line, as shown here: h1, h2, p { font-family:arial; color:blue; }

SHARED ATTRIBUTES h1, h2, p { font-family:arial; color:blue; } Albert Einstein Insanity Definition Insanity: doing the same thing over and over again and expecting different results.

USING MULTIPLE CLASS DEFINITIONS.bold { font-weight:bold; }.quote { font-style:italic; } This text is normal. Albert Einstein A person who never made a mistake never tried anything new. ( )

USING CLASS NAMES As you format a page, there may be times when you will want to define specific classes which use a meaningful name, such as center, but which require different attribute settings. For example, you may want to use a class named center which would requires different attributes for text and an image. In such cases, you can define class specific attributes:.center { text-align:center; } img.center { display:block; margin-left:auto; margin-right:auto; } The first class definition is generic in that it does not specify a selector. The second class definition, however, img.center, will apply only to the tag.

CLASS NAME DEMO.center { text-align:center; } img.center { display:block; margin-left:auto; margin-right:auto; } Steve Jobs Design is not just what it looks like and feels like. Design is how it works.

USING MOST ATTRIBUTES In a similar way, there may be times when you want to use most of the attributes defined in a class, but not all. For example, the following statements define a class named SiteFont which sets the font family, color, and alignment:.SiteFont { font-family:arial; color:blue; text-align:left; } Assume, however, that you want paragraph text to appear in red. To do so, you can modify the class definition specifically for the element, changing or adding definitions, while leaving the remaining class attributes unchanged:.SiteFont { font-family:arial; color:blue; text-align:left; } p.SiteFont { color:red; }

CHANGING PARAGRAPH ATTRIBUTE.SiteFont { font-family:arial; color:blue; text-align:left; } p.SiteFont { color:red; } This uses the SiteFont defition So does this default paragraph. This one overrides the color attribute.

ID-BASED STYLES Most HTML tags support an id attribute that lets you associate a name with a specific element within your page: The heading content The paragraph content Just as CSS lets you define attributes for specific tags, it also lets you define attributes for a specific element id. To do so, you specify the id following a pound sign (#), as shown here: #idName { style definition } Defining an id-based selector is similar to defining a class. However, unlike a class which you can apply to multiple tags or elements, the id-based selector is specific to one element within your page.

ID-BASED STYLE DEMO.SiteFont { font-family:arial; color:blue; text-align:left; } #LastParagraph { color:red; } This uses the SiteFont defition So does this default paragraph. This one overrides the color attribute--using an id attribute.

PSEUDO CLASSES

PSEDUO-CLASS DEMO a:hover{ background-color:yellow; } a:visited { background-color:red; } a:selected { background-color:blue; } a:link { background-color:orange; } Head of the Class

ADDITIONAL PSEUDO CLASSES

PSEUDO-CLASS DEMO p:first-child { background-color: yellow; } p { background-color:white; } :not(p) { background-color: orange } li:first-of-type { font-size:200%; } This is the first paragraph within the body. This is the first list element. Second list element Third list element This paragraph should be on white.

CSS PSEUDO ELEMENTS

DEMO p:first-letter { font-size:300%; color:Blue; } Imagination is more important than knowledge. Albert Einstein

REAL WORLD – CERTIFICATION PROCESS

SUMMARY Across the Web, developers make extensive use of cascading style sheets to format the appearance of objects within an HTML page. You can create CSS class definitions which you can then apply to specific HTML tags using each tag’s class attribute. You can define selector-specific classes and id-based classes. CSS defines pseudo classes which correspond to an object’s state or position, such as having the mouse over the object, or the object being the first element in a list.