>> CSS Rules Selection

Slides:



Advertisements
Similar presentations
CSS-Formatting Review Cascading Style Sheets addstyle to your HTML web pages.
Advertisements

CSS Cascading Style Sheets. Objectives Using Inline Styles Working with Selectors Using Embedded Styles Using an External Style Sheet Applying a Style.
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.
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.
Cascading Style Sheets Understanding styles. The term cascading describe the capability of a local style to override a general style. CSS applies style.
Cascading Style Sheets Controlling the Display Of Web Content.
Cascading Style Sheets Controlling the Display Of Web Content.
4.01 Cascading Style Sheets
Cascading Style Sheets (CSS) Instructor: Mr. Ahmed Al Astal ITGD4104 Department Requirement for senior student University of Palestine Faculty of IT.
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.
 This presentation introduces the following: › 3 types of CSS › CSS syntax › CSS comments › CSS and color › The box model.
Css. Definition Cascading style sheet (CSS) Cascading Style Sheets (CSS) is a simple mechanism for adding style (e.g. fonts, colors, spacing) to Web documents.
Cascading Style Sheets Orientation Learning Web Design: Chapter 11.
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.
© 2011 Delmar, Cengage Learning Chapter 8 Using Styles and Design Style Sheets for Design.
Cascading Style Sheets Part 1. CSS vs HTML HTML: Originally intended to markup structure of a document (,...,,,,,...) CSS Developing technology, CSS1,
XP Tutorial 7New Perspectives on HTML and XHTML, Comprehensive 1 Working with Cascading Style Sheets Tutorial 7.
Css. Definition Cascading style sheet (CSS)  It is a simple mechanism for adding style (e.g. fonts, colors, spacing) to Web documents.
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 A very brief introduction CSS, Cascading Style Sheets1.
Designing Web Pages The case for CSS. The Power of CSS css Zen Garden
Department of Computer Science, Florida State University CGS 3066: Web Programming and Design Spring
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.
Chapter 6 Introducing Cascading Style Sheets Principles of Web Design, Third Edition.
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…
CASCADING STYLE SHEET 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.
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.
CSS (Cascading Style Sheets). CSS CSS – Cascading Style Sheets – Cascade because of the way CSS rules can stack on top of each other. Allows you to add.
Cascading Style Sheets (CSS) Internal Style Sheets Classes
Working with Cascading Style Sheets
External Style Sheets.
Cascading Style Sheets
Getting Started with CSS
4.01 Cascading Style Sheets
An Introduction to Cascading Style Sheets
>> Introduction to CSS
Cascading Style Sheets
Introduction to the Internet
>> The “Box” Model
Cascading Style Sheets
IS 360 Declaring CSS Styles
Madam Hazwani binti Rahmat
Cascading Style Sheets
Introduction to Web programming
Intro to CSS CS 1150 Fall 2016.
CASCADING STYLE SHEET CSS.
Cascading Style Sheets: Basics
Website Design 3
Introduction to Web programming
Intro to CSS CS 1150 Spring 2017.
>> Dynamic CSS Selectors
DynamicHTML Cascading Style Sheet Internet Technology.
CS134 Web Design & Development
Working with Cascading Style Sheets (CSS)
Working with Cascading Style Sheets (CSS)
What are Cascading Stylesheets (CSS)?
Cascading Style Sheets
DynamicHTML Cascading Style Sheet Internet Technology.
CSS: Cascading Style Sheets
Tutorial 3 Working with Cascading Style Sheets
Web Design and Development
Chapter 6 Introducing Cascading Style Sheets
Web Design & Development
Cascading Style Sheets
Session 3: Basic CSS Spring 2009
4.01 Cascading Style Sheets
CS332A Advanced HTML Programming
CGS 3066: Web Programming and Design Fall 2019
Presentation transcript:

>> CSS Rules Selection

Recall CSS allows adding style to HTML CSS Rule = Selector + Declaration Declaration = Property + Value Types of Selectors Element/Type Selector ID Selector (#) Class Selector (.) Combining Selectors Use a “,”

Web-based Systems | Misbhauddin Source Location 1 of 3: Inline Styles <h1 style="color : red;" >Welcome to my page</h1> Style attribute Note: Affects only the tag it is in Web-based Systems | Misbhauddin

Web-based Systems | Misbhauddin Source Location 2 of 3: Embedded Styles <head> <style type="text/css"> h1 { color : red; } </style> </head> Usually in the head tag Note: Affects the entire page it is on. Web-based Systems | Misbhauddin

Web-based Systems | Misbhauddin Source Location style.css 3 of 3: External Styles h1 { color : red; } Usually in the head tag <html> <head> <link rel="stylesheet“ href=“style.css“ type="text/css“ /> </head> <body> </body> </html> Note: Affects any page it is linked to Web-based Systems | Misbhauddin

Web-based Systems | Misbhauddin Origin Style sheets defined by the author of the HTML file Author Styles Style sheets defined by the user of the machine User Styles Every browser has a different way of displaying elements Browser Defaults Web-based Systems | Misbhauddin

Inheritance A tag can inherit styles defined by the parent tag, except for some properties such as margin, padding, ….. <div> <h1>Main</h1> <p>Hello World</p> </div div { color:red; } Main Hello World Overriding Inheritance Forcing Inheritance Use “inherit” value in the property Define another rule which is more specific Example: margin: inherit;

Order The last instance of the style declared is the one applied to the page div { color:red; } color: green; Main Hello World

Importance Forcing a style to be applied irrespective of the rules div { color:red !important; } color: green; Main Hello World

1 (# of element selectors) Specificity The more specific you are about the context of a CSS rule, the more likely it is that the style will be applied to the element. Lowest Element Selector Rule Weight Calculation 100(# of ID selectors) + 10 (# of class selectors) 1 (# of element selectors) Class Selector Highest ID Selector

Web-based Systems | Misbhauddin 2 2 2 Inline Important ID Class Element / Type Div span .class #id1 #id2 .test Div span .class Web-based Systems | Misbhauddin

Specificity - Practice <h1>This is <strong class="hilight">Amazing</strong></h1> Rule 1: h1 .hilight { color: purple; } Rule 2:.hilight { color: orange; } Which one?

The “C” in CSS Highest Lowest Inline Styles Importance Specificity Order Inherited Browser Defaults Lowest

Next on Web-based Systems Cascading Style Sheets More on CSS Selectors Using to format the layout of an HTML page Using <div>, <span> tags and CSS code