SlideShare una empresa de Scribd logo
1 de 53
Descargar para leer sin conexión
webdev@rgu
styling with css
overview
purpose of css
syntax of css
benefits of css
APPLYING CSS
USING CSS WITH HTML
CSS Selectors
Pseudo Selectors
CSS Values and Units
PURPOSE OF
CSS
HTML IS USED TO SPECIFY CONTENT AND
STRUCTURE
• CONTENT: TEXT IN PARAGRAPHS, DATA IN TABLES,
IMAGES AND OTHER MEDIA
• STRUCTURE: LOGICAL FLOW OF PAGE
COMPONENTS CONTAINING CONTENT (E.G. DIVS,
SECTIONS HEADERS ETC.)
overview
CASCADING STYLE SHEETS (CSS) ARE USED TO
SPECIFY THE PRESENTATION STYLE AND LAYOUT OF
ELEMENTS WITHIN AN HTML PAGE
• DISTINCT WEB TECHNOLOGY
• NOT PROGRAMMING OR MARK-UP LANGUAGE
• SIMPLE A SEQUENCE OF RULES TO APPLY
CSS DECLARES RULES THAT:
• SELECT WHICH HTML ELEMENTS SHOULD BE
STYLED
• SPECIFY THE PROPERTIES TO MANIPULATE
• GIVE VALUES TO THESE PROPERTIES
OPERATION
WEB BROWSERS COMBINE HTML AND CSS TO
RENDER A COMPLETE WEB PAGE
• BOTH MUST BE LINKED TOGETHER
• SORT BY SPECIFICITY ALL DECLARATIONS
APPLYING TO A GIVEN ELEMENT.
• THOSE ELEMENTS WITH A HIGHER
SPECIFICITY HAVE MORE WEIGHT THAN
THOSE WITH LOWER SPECIFICITY
• SORT BY ORDER ALL DECLARATIONS APPLYING TO
A GIVEN ELEMENT.
• THE LATER A DECLARATION APPEARS IN THE
STYLE SHEET OR DOCUMENT, THE MORE
WEIGHT IT IS GIVEN
• DECLARATIONS THAT APPEAR IN AN
IMPORTED STYLE SHEET ARE CONSIDERED TO
COME BEFORE ALL DECLARATIONS WITHIN
THE STYLE SHEET THAT IMPORTS THEM.
cascading rules
cascading rules
default browser styles
user style styles
author style sheet
Author embedded styles
Author inline styles
SYNTAX OF
CSS
FIND EVERY <H2> ELEMENT ON A PAGE (SELECT)
SPECIFY THAT ITS COLOUR (PROPERTY)
SHOULD BE BLUE (VALUE)
EXAMPLE
H2 {
COLOR: “BLUE”;
}
CSS SYNTAX PATTERN
SELECTOR1 {
PROPERTY: “VALUE”;
}
SELECTOR2 {
PROPERTY1: “VALUE”;
PROPERTY2: “VALUE”;
PROPERTY: “VALUE”;
}
SYNTAX RULES TO REMEMBER
SELECTOR1 {
PROPERTY: “VALUE”;
}
SYNTAX RULES TO REMEMBER
SELECTOR1 {
PROPERTY: “VALUE”;
}
1. SELECTOR IDENTIFIES THE HTML ELEMENTS THAT
THE RULE(S) WILL BE APPLIED TO
SYNTAX RULES TO REMEMBER
SELECTOR1 {
PROPERTY: “VALUE”;
}
1. SELECTOR IDENTIFIES THE HTML ELEMENTS THAT
THE RULE(S) WILL BE APPLIED TO
2. CURLY BRACKETS CONTAIN ALL OF THE RULES
FOR THIS SELECTOR
SYNTAX RULES TO REMEMBER
SELECTOR1 {
PROPERTY: “VALUE”;
}
1. SELECTOR IDENTIFIES THE HTML ELEMENTS THAT
THE RULE(S) WILL BE APPLIED TO
2. CURLY BRACKETS CONTAIN ALL OF THE RULES
FOR THIS SELECTOR
3. RULES ARE SEPARATED BY A SEMICOLON
SYNTAX RULES TO REMEMBER
SELECTOR1 {
PROPERTY: “VALUE”;
}
1. SELECTOR IDENTIFIES THE HTML ELEMENTS THAT
THE RULE(S) WILL BE APPLIED TO
2. CURLY BRACKETS CONTAIN ALL OF THE RULES
FOR THIS SELECTOR
3. RULES ARE SEPARATED BY A SEMICOLON
4. THE PROPERTY OF A RULE DEFINES WHAT ASPECT
OF THE ELEMENT WILL BE AFFECTED
1. COLOUR, FONT, POSITION, BORDERS ETC.)
SYNTAX RULES TO REMEMBER
SELECTOR1 {
PROPERTY: “VALUE”;
}
1. SELECTOR IDENTIFIES THE HTML ELEMENTS THAT
THE RULE(S) WILL BE APPLIED TO
2. CURLY BRACKETS CONTAIN ALL OF THE RULES
FOR THIS SELECTOR
3. RULES ARE SEPARATED BY A SEMICOLON
4. THE PROPERTY OF A RULE DEFINES WHAT ASPECT
OF THE ELEMENT WILL BE AFFECTED
1. COLOUR, FONT, POSITION, BORDERS ETC.)
5. THE VALUE OF A RULE SPECIFIES HOW THE
PROPERTY WILL BE AFFECTED
SYNTAX RULES TO REMEMBER
SELECTOR1 {
PROPERTY: “VALUE”;
}
1. SELECTOR IDENTIFIES THE HTML ELEMENTS THAT
THE RULE(S) WILL BE APPLIED TO
2. CURLY BRACKETS CONTAIN ALL OF THE RULES
FOR THIS SELECTOR
3. RULES ARE SEPARATED BY A SEMICOLON
4. THE PROPERTY OF A RULE DEFINES WHAT ASPECT
OF THE ELEMENT WILL BE AFFECTED
1. COLOUR, FONT, POSITION, BORDERS ETC.)
5. THE VALUE OF A RULE SPECIFIES HOW THE
PROPERTY WILL BE AFFECTED
6. PROPERTIES AND THEIR VALUES ARE SEPARATED
BY A COLON
TABLE
{
WIDTH: 80%;
MARGIN: 0;
BACKGROUND: #FFFFFF;
BORDER: 1PX SOLID #333333;
}
STYLE.CSS
<TABLE>
<CAPTION>THIS IS MY TABLE CAPTION</CAPTION>
</TABLE>
INDEX.HTML
BENEFITS OF
CSS
OVERCOMES THE LIMITATIONS OF ADDING STYLE
USING HTML ALONE
• BASIC TABLES AND FORMS
VERY SIMPLE WEB TECHNOLOGY (IN TERMS OF
SYNTAX) YET VERY POWERFUL
• ENDLESS COMBINATIONS OF RULES FOR
ELEMENTS
BENEFITS OF CSS
INDEX.HTML
ABOUT.HTML
PHOTOS.HTML
MIKEISAWESOME
.HTML
STYLE.CSS
EDIT A SINGLE
FILE PROPAGATES
CHANGES TO ALL
FILES
INDEX.HTML
ABOUT.HTML
PHOTOS.HTML
MIKEISAWESOME
.HTML
STYLE.CSS
MORESTYLE
.CSS
CAN LINK TO
MULTIPLE STYLE
SHEETS
.HTML
CONTENT &
STRUCTURE
CONCERNS
.CSS
PRESENTATION &
LAYOUT
CONCERNS
• CASCADING STYLE SHEETS (CSS) IS A METHOD OF
SEPARATING A PAGE’S STRUCTURE AND CONTENT
FROM ITS PRESENTATION
• CSS ALLOWS FOR A MUCH RICHER PAGE
APPEARANCE THAN WITH HTML ALONE (NO MORE
TABLES)
• CSS CAN SAVE TIME AS THE APPEARANCE OF THE
ENTIRE PAGE APP CAN BE CREATED AND CHANGED
IN JUST ONE PLACE
• CSS CAN IMPROVE LOAD TIMES AS IT COMPACTLY
STORES THE PRESENTATION CONCERNS OF A PAGE
IN ONE PLACE INSTEAD OF BEING REPEATED
THROUGHOUT THE PAGE
benefits of css
• THERE ARE DIFFERENT SELECTOR RULES BEYOND
SIMPLE ELEMENTS
• THERE ARE LOTS OF PROPERTIES AND THEY VARY
ACROSS DIFFERENT HTML ELEMENTS
• THERE ARE MANY PROPERTY/VALUE
COMBINATIONS; NOT ALL OF WHICH WORK AS
EXPECTED
CHALLENGES OF CSS
APPLYING
CSS
• STYLESHEETS DESCRIBE THE RENDERING OF HTML
ELEMENTS
• THEY SPECIFY STYLISTIC ASPECTS OF INDIVIDUAL
ELEMENTS OR ALL ELEMENTS OF A PARTICULAR
KIND
• A CSS CONSISTS OF A SET OF FORMATTING RULES,
WHICH ARE SPECIFIED IN THE FOLLOWING WAY:
APPLYING CSS
SELECTOR2 {
PROPERTY1: “VALUE”;
PROPERTY2: “VALUE”;
PROPERTY: “VALUE”;
}
APPLYING STYLESSELECTOR2 {
PROPERTY1: “VALUE”;
PROPERTY2: “VALUE”;
PROPERTY: “VALUE”;
}
P {
FONT-SIZE: 12PT;
FONT-FAMILY: “VERDANA”;
}
APPLIES TO ALL <P>
ELEMENTS
H1, H2, H3 {
COLOR: RED;
FONT-SIZE: 18PX;
}
APPLIES TO ALL
<H1>,<H2>, AND
<H3> ELEMENTS
APPLYING STYLESSELECTOR2 {
PROPERTY1: “VALUE”;
PROPERTY2: “VALUE”;
PROPERTY: “VALUE”;
}
* {
TEXT-ALIGN: LEFT;
}
APPLIES TO ALL
ELEMENTS
#MENU A {
PADDING: 45PX 25PX 0PX 0PX;
B0RDER: NONE;
}
APPLIES TO ALL <A>
ELEMENTS WITH
ID=“MENU
APPLYING STYLESSELECTOR2 {
PROPERTY1: “VALUE”;
PROPERTY2: “VALUE”;
PROPERTY: “VALUE”;
}
.menu {
PADDING: 100PX;
}
APPLIES TO ALL
ELEMENTS WITH
CLASS=MENU
LOTS MORE EXIST…HERES A GOOD REFERENCE
http://www.w3schools.com/cssref/css_selectors.asp
USING CSS WITH HTML
APPLYING
CSS
• INLINE: STYLE INFORMATION IS ADDED DIRECTLY
TO ONE PARTICULAR ELEMENT USING ITS STYLE
ATTRIBUTE
• CSS SYNTAX IS USED AFTER THE STYLE ATTRIBUTE
IN AN HTML TAG
• THIS ONLY EFFECTS THIS ELEMENT, 

OTHERS OF THE SAME TYPE ARE NOT EFFECTED.
• USEFUL TO OVERRIDE EXISTING STYLE, BUT
BREAKS THE SEPARATION OF CONTENT AND
PRESENTATION
INLINE CSS SPECIFICATION
<H3 STYLE=“COLOUR: GREEN; FONT-SIZE: 18PT”>
• EMBEDDED: STYLE RULES CAN BE SPECIFIED IN
THE <HEAD> SECTION OF THE PAGE
• THESE RULES WILL BE APPLIED TO THE ENTIRE
PAGE
EMBEDDED CSS SPECIFICATION
<html>
<head>
<style>
h3 { color: yellow; font-size: 18pt; }
</style>
</head>
<body>
<h3> This will be yellow font size 18 </h3>
…
</body>
</html>
• EXTERNAL: IN A SEPARATE FILE WHICH CAN BE
SHARED BY SEVERAL PAGES. THE FILE EXTENSION
IS “.CSS”
• THIS IS PERHAPS THE BEST METHOD IN TERMS OF:
• SEPARATION OF CONCERNS
• MAINTENANCE
• PERFORMANCE
EXTERNAL CSS SPECIFICATION
<head>
<link rel="stylesheet" href="master.css" type="text/
css">
</head>
CSS Selectors
APPLYING
CSS
• CLASS AND ID SELECTORS CAN BE USED FOR
FINER CONTROL
• THIS INVOLVES MORE PLANNING/EFFORT WITH
PAGE MARKUP
• BUT CAN RESULT IN A BETTER USER
EXPERIENCE
• IT IS ALSO VERY IMPORTANT FOR
MANIPULATING ELEMENTS IN JAVASCRIPT
• THE EFFORT ALSO PAYS OFF IF YOU USE
LIBRARIES LIKE JQUERY
SPECIALISATION OF PRESENTATION
• USED TO DEFINE A SPECIAL CASE FOR AN
ELEMENT
• IDS ARE MEANT TO UNIQUE AND ONLY USED
ONCE
• HOWEVER, SOME BROWSERS ARE NOT
PARTICULARLY FUSSY
ID SELECTORS
#first-para
{
font-weight: bold;
}
<p id=“first-para”>This
paragraph will be bold-
faced</p>
<p>This will not be bold</p>
class SELECTORS
.warning {
font-weight: bold;
}
<p class="warning">This text
will be displayed in bold.</p>
<p>This text will NOT be
displayed in bold.</p>
• CLASS SELECTOR ALLOW YOU TO STYLE ITEMS
WITH THE SAME HTML ELEMENT DIFFERENTLY
• THEY WORK WHEN THE CLASS ATTRIBUTE OF AN
HTML TAG IS GIVEN A NAME
• USED TO STYLE MANY HTML ELEMENTS
TAG SELECTORS
h1 {
color: green;
}
p {
color: red;
}
<h1>This will be green</h1>
<p>This will be red</p>
• USED TO STYLE SPECIFIC TAGS
grouping
h1, h2, h3 {
color: green;
}
p {
color: red;
}
<h1>This will be green</h1>
<h2>So will this</h2>
<h3>and so will this</h3>
<p>This will be red</p>
• MULTIPLE SELECTORS CAN BE GROUPED
TOGETHER
descendant selectors
section.news h1 {
color: green;
}
<section class=news>
<div>
<h1>This will be green</
h1>
</div>
</section>
• USED TO SELECT ELEMENTS THAT ARE
DECEDENTS OF THE ELEMENT IN THE DOCUMENT
TREE
• NOT NECESSARILY DIRECT CHILDREN
child selectors
section.news > h1 {
color: green;
}
<section class=news>
<div>
<h1>This will not be
green</h1>
</div>
</section>
• USED TO SELECT CHILD
ELEMENTS THAT ARE
DECEDENTS OF THE
ELEMENT IN THE
DOCUMENT TREE
<section id=news>
<h1>This will be green</h1>
</section>
adjacent sibling selectors
h1 + h2 {
color: green;
}
<h1>Green</h1>
<h2>Green</h2>
<p>Not Green</p>
• SELECT THE SIBLING
ELEMENT DIRECTLY
FOLLOWING ANOTHER
ELEMENT
<h1>Not Green</h1>
<p>Not Green</p>
<h2>Not Green</h2>
universal selectors
* {
color: blue;
}
<h1>This is blue</h1>
<p>This is blue</p>
<ul>
<li>All the things are blue</li>
</ul>
• USED TO SELECT ELEMENTS THAT ARE
DECEDENTS OF THE ELEMENT IN THE DOCUMENT
TREE
• NOT NECESSARILY DIRECT CHILDREN
pseudo selectors
APPLYING
CSS
• WE CAN APPLY EVEN MORE DETAILED CSS TO
ELEMENTS THROUGH THE USE OF PSEUDO
CLASSES
• CAN BE USED TO:
• STYLE AN ELEMENT WHEN A MOUSE IS OVER IT
• STYLE VISITED AND UNVISITED LINKS
• STYLE A FOCUSED ELEMENT
pseudo elements
colouring links
/* MOUSE OVER LINK */
A:HOVER {
COLOR: #FF00FF;
}
/* SELECTED LINK */
A:ACTIVE {
COLOR: #0000FF;
}
/* UNVISITED LINK */
A:LINK {
COLOR: #FF0000;
}
/* VISITED LINK */
A:VISITED {
COLOR: #00FF00;
}
other pseudo elements
:AFTER
:BEFORE
:FIRST-CHILD
:FOCUS
:FIRST-LETTER
:FIRST-LINE
:LANG
• MORE EXISTS BUT FOR THE MOST PART YOU’LL
WANT TO USE THE ONES THAT CAN COLOUR
LINKS.
CSS Values and Units
APPLYING
CSS
• WORDS
• AFFECT THE COLOURS, DISTANCES, AND SIZES
OF A WHOLE HOST OF PROPERTIES OF AN
ELEMENTS STYLE
• TEXT-ALIGN: CENTRE;
VALUES AND UNITS
• NUMERICAL VALUES
• NORMALLY FOLLOWED BY A UNIT TYPE
• LENGTH UNITS
• INCHES (IN)
• CENTIMETERS (CM)
• MILLIMETERS (MM)
• POINTS (PT)
• PICAS (PI)
• RELATIVE UNITS
• EM IS RELATIVE TO THE GIVEN FONT-SIZE VALUE
• E.G. FONT SIZE IS 14PX, 1EM=14PX
• PX IS (SHOULD) BE THE SIZE OF A PIXEL ON THE
MONITOR
• GENERALLY THE RECOMMENDED UNIT TO USE
VALUES AND UNITS
• COLOUR
• NAMED COLOURS (RED)
• FUNCTIONAL RGB (255,0,0)
• HEXADECIMAL RGU CODES (#FF0000)
VALUES AND UNITS
recap
purpose of css
syntax of css
benefits of css
APPLYING CSS
USING CSS WITH HTML
CSS Selectors
Pseudo Selectors
CSS Values and Units

Más contenido relacionado

La actualidad más candente

Intro to HTML and CSS basics
Intro to HTML and CSS basicsIntro to HTML and CSS basics
Intro to HTML and CSS basicsEliran Eliassy
 
Introduction to HTML
Introduction to HTMLIntroduction to HTML
Introduction to HTMLAmit Tyagi
 
Supercharged HTML & CSS
Supercharged HTML & CSSSupercharged HTML & CSS
Supercharged HTML & CSSMax Kraszewski
 
Introduction to HTML and CSS
Introduction to HTML and CSSIntroduction to HTML and CSS
Introduction to HTML and CSSMario Hernandez
 
Web fundamental concept and tags
Web fundamental concept and tags Web fundamental concept and tags
Web fundamental concept and tags shameen khan
 
HTML und CSS für Designer / HTML & CSS for designers (PUBKON 2014)
HTML und CSS für Designer / HTML & CSS for designers (PUBKON 2014)HTML und CSS für Designer / HTML & CSS for designers (PUBKON 2014)
HTML und CSS für Designer / HTML & CSS for designers (PUBKON 2014)Michaela Lehr
 
(Fast) Introduction to HTML & CSS
(Fast) Introduction to HTML & CSS (Fast) Introduction to HTML & CSS
(Fast) Introduction to HTML & CSS Dave Kelly
 
An Intro to HTML & CSS
An Intro to HTML & CSSAn Intro to HTML & CSS
An Intro to HTML & CSSShay Howe
 
CSS pattern libraries
CSS pattern librariesCSS pattern libraries
CSS pattern librariesRuss Weakley
 
CSS: a rapidly changing world
CSS: a rapidly changing worldCSS: a rapidly changing world
CSS: a rapidly changing worldRuss Weakley
 
How Cascading Style Sheets (CSS) Works
How Cascading Style Sheets (CSS) WorksHow Cascading Style Sheets (CSS) Works
How Cascading Style Sheets (CSS) WorksAmit Tyagi
 
Html / CSS Presentation
Html / CSS PresentationHtml / CSS Presentation
Html / CSS PresentationShawn Calvert
 

La actualidad más candente (20)

Intro to HTML and CSS basics
Intro to HTML and CSS basicsIntro to HTML and CSS basics
Intro to HTML and CSS basics
 
Page layout with css
Page layout with cssPage layout with css
Page layout with css
 
Introduction to HTML
Introduction to HTMLIntroduction to HTML
Introduction to HTML
 
Html Expression Web
Html Expression WebHtml Expression Web
Html Expression Web
 
uptu web technology unit 2 Css
uptu web technology unit 2 Cssuptu web technology unit 2 Css
uptu web technology unit 2 Css
 
Supercharged HTML & CSS
Supercharged HTML & CSSSupercharged HTML & CSS
Supercharged HTML & CSS
 
Introduction to HTML and CSS
Introduction to HTML and CSSIntroduction to HTML and CSS
Introduction to HTML and CSS
 
Web fundamental concept and tags
Web fundamental concept and tags Web fundamental concept and tags
Web fundamental concept and tags
 
uptu web technology unit 2 Css
uptu web technology unit 2 Cssuptu web technology unit 2 Css
uptu web technology unit 2 Css
 
Css Basics
Css BasicsCss Basics
Css Basics
 
HTML und CSS für Designer / HTML & CSS for designers (PUBKON 2014)
HTML und CSS für Designer / HTML & CSS for designers (PUBKON 2014)HTML und CSS für Designer / HTML & CSS for designers (PUBKON 2014)
HTML und CSS für Designer / HTML & CSS for designers (PUBKON 2014)
 
(Fast) Introduction to HTML & CSS
(Fast) Introduction to HTML & CSS (Fast) Introduction to HTML & CSS
(Fast) Introduction to HTML & CSS
 
Html cia
Html ciaHtml cia
Html cia
 
An Intro to HTML & CSS
An Intro to HTML & CSSAn Intro to HTML & CSS
An Intro to HTML & CSS
 
CSS pattern libraries
CSS pattern librariesCSS pattern libraries
CSS pattern libraries
 
CSS Basics
CSS BasicsCSS Basics
CSS Basics
 
CSS: a rapidly changing world
CSS: a rapidly changing worldCSS: a rapidly changing world
CSS: a rapidly changing world
 
CSS
CSSCSS
CSS
 
How Cascading Style Sheets (CSS) Works
How Cascading Style Sheets (CSS) WorksHow Cascading Style Sheets (CSS) Works
How Cascading Style Sheets (CSS) Works
 
Html / CSS Presentation
Html / CSS PresentationHtml / CSS Presentation
Html / CSS Presentation
 

Destacado

Intro to css & sass
Intro to css & sassIntro to css & sass
Intro to css & sassSean Wolfe
 
HTML - Basics and Good Practices
HTML - Basics and Good PracticesHTML - Basics and Good Practices
HTML - Basics and Good PracticesPriscila Negreiros
 
Sql Injection and XSS
Sql Injection and XSSSql Injection and XSS
Sql Injection and XSSMike Crabb
 
Sass - Getting Started with Sass!
Sass - Getting Started with Sass!Sass - Getting Started with Sass!
Sass - Getting Started with Sass!Eric Sembrat
 
Crew, Foia, Documents 012829 - 012917
Crew, Foia, Documents 012829 - 012917Crew, Foia, Documents 012829 - 012917
Crew, Foia, Documents 012829 - 012917Obama White House
 
Derecho de los pueblos a la auto determinación
Derecho de los pueblos a la  auto determinaciónDerecho de los pueblos a la  auto determinación
Derecho de los pueblos a la auto determinaciónFrank Ragol
 
Trastornos alimenticios.
Trastornos alimenticios.Trastornos alimenticios.
Trastornos alimenticios._danielahm
 
Plan de mejora de hoy.com.ec
Plan de mejora de hoy.com.ecPlan de mejora de hoy.com.ec
Plan de mejora de hoy.com.ecAdriana Alban
 
2012 ACS Skolnik Symposium - ChemSpotlight
2012 ACS Skolnik Symposium - ChemSpotlight2012 ACS Skolnik Symposium - ChemSpotlight
2012 ACS Skolnik Symposium - ChemSpotlightGeoffrey Hutchison
 
Tutorial de como crear particiones de disco duro en windows 10
Tutorial de como crear particiones de disco duro en windows 10Tutorial de como crear particiones de disco duro en windows 10
Tutorial de como crear particiones de disco duro en windows 10luisberazaarieta
 
Success with user stories: cut thru user story chaos (ProductCampBoston 2015)
Success with user stories: cut thru user story chaos (ProductCampBoston 2015)Success with user stories: cut thru user story chaos (ProductCampBoston 2015)
Success with user stories: cut thru user story chaos (ProductCampBoston 2015)ProductCamp Boston
 
Bono + Jony Ive: A Conversation #OgilvyCannes #CannesLions
Bono + Jony Ive: A Conversation #OgilvyCannes #CannesLionsBono + Jony Ive: A Conversation #OgilvyCannes #CannesLions
Bono + Jony Ive: A Conversation #OgilvyCannes #CannesLionsOgilvy
 
Searching 2.0 (EI & PEN)
Searching 2.0 (EI & PEN)Searching 2.0 (EI & PEN)
Searching 2.0 (EI & PEN)Michael Sauers
 
InTASC Standards
InTASC StandardsInTASC Standards
InTASC Standardstaylorjaye
 

Destacado (20)

CSS Secrets - Lea Verou
CSS Secrets - Lea VerouCSS Secrets - Lea Verou
CSS Secrets - Lea Verou
 
Intro to css & sass
Intro to css & sassIntro to css & sass
Intro to css & sass
 
HTML - Basics and Good Practices
HTML - Basics and Good PracticesHTML - Basics and Good Practices
HTML - Basics and Good Practices
 
The Art of CSS
The Art of CSSThe Art of CSS
The Art of CSS
 
Sass presentation
Sass presentationSass presentation
Sass presentation
 
Sql Injection and XSS
Sql Injection and XSSSql Injection and XSS
Sql Injection and XSS
 
Sass - Getting Started with Sass!
Sass - Getting Started with Sass!Sass - Getting Started with Sass!
Sass - Getting Started with Sass!
 
Crew, Foia, Documents 012829 - 012917
Crew, Foia, Documents 012829 - 012917Crew, Foia, Documents 012829 - 012917
Crew, Foia, Documents 012829 - 012917
 
Derecho de los pueblos a la auto determinación
Derecho de los pueblos a la  auto determinaciónDerecho de los pueblos a la  auto determinación
Derecho de los pueblos a la auto determinación
 
Trastornos alimenticios.
Trastornos alimenticios.Trastornos alimenticios.
Trastornos alimenticios.
 
Plan de mejora de hoy.com.ec
Plan de mejora de hoy.com.ecPlan de mejora de hoy.com.ec
Plan de mejora de hoy.com.ec
 
2012 ACS Skolnik Symposium - ChemSpotlight
2012 ACS Skolnik Symposium - ChemSpotlight2012 ACS Skolnik Symposium - ChemSpotlight
2012 ACS Skolnik Symposium - ChemSpotlight
 
Tutorial de como crear particiones de disco duro en windows 10
Tutorial de como crear particiones de disco duro en windows 10Tutorial de como crear particiones de disco duro en windows 10
Tutorial de como crear particiones de disco duro en windows 10
 
Success with user stories: cut thru user story chaos (ProductCampBoston 2015)
Success with user stories: cut thru user story chaos (ProductCampBoston 2015)Success with user stories: cut thru user story chaos (ProductCampBoston 2015)
Success with user stories: cut thru user story chaos (ProductCampBoston 2015)
 
Impact Outside Academia
Impact Outside AcademiaImpact Outside Academia
Impact Outside Academia
 
Bono + Jony Ive: A Conversation #OgilvyCannes #CannesLions
Bono + Jony Ive: A Conversation #OgilvyCannes #CannesLionsBono + Jony Ive: A Conversation #OgilvyCannes #CannesLions
Bono + Jony Ive: A Conversation #OgilvyCannes #CannesLions
 
2013 Year End Commercial Real Estate Review
2013 Year End Commercial Real Estate Review2013 Year End Commercial Real Estate Review
2013 Year End Commercial Real Estate Review
 
Searching 2.0 (EI & PEN)
Searching 2.0 (EI & PEN)Searching 2.0 (EI & PEN)
Searching 2.0 (EI & PEN)
 
Journal Data Requirements
Journal Data Requirements Journal Data Requirements
Journal Data Requirements
 
InTASC Standards
InTASC StandardsInTASC Standards
InTASC Standards
 

Similar a CSS Guide for Styling Web Pages

Similar a CSS Guide for Styling Web Pages (20)

Complete Lecture on Css presentation
Complete Lecture on Css presentation Complete Lecture on Css presentation
Complete Lecture on Css presentation
 
Responsive web design with html5 and css3
Responsive web design with html5 and css3Responsive web design with html5 and css3
Responsive web design with html5 and css3
 
Week11 Lecture: CSS
Week11 Lecture: CSSWeek11 Lecture: CSS
Week11 Lecture: CSS
 
4. Web Technology CSS Basics-1
4. Web Technology CSS Basics-14. Web Technology CSS Basics-1
4. Web Technology CSS Basics-1
 
Html Styles-CSS
Html Styles-CSSHtml Styles-CSS
Html Styles-CSS
 
css-presentation.ppt
css-presentation.pptcss-presentation.ppt
css-presentation.ppt
 
Css introduction
Css introductionCss introduction
Css introduction
 
Beginners css tutorial for web designers
Beginners css tutorial for web designersBeginners css tutorial for web designers
Beginners css tutorial for web designers
 
Lecture-6.pptx
Lecture-6.pptxLecture-6.pptx
Lecture-6.pptx
 
Cascading Style Sheets for web browser.pptx
Cascading Style Sheets for web browser.pptxCascading Style Sheets for web browser.pptx
Cascading Style Sheets for web browser.pptx
 
Css
CssCss
Css
 
Cascading Style Sheets
Cascading Style SheetsCascading Style Sheets
Cascading Style Sheets
 
Introduction to CSS
Introduction to CSSIntroduction to CSS
Introduction to CSS
 
Css.html
Css.htmlCss.html
Css.html
 
Css
CssCss
Css
 
CLIENT SIDE PROGRAMMING
CLIENT SIDE PROGRAMMINGCLIENT SIDE PROGRAMMING
CLIENT SIDE PROGRAMMING
 
CSS.ppt
CSS.pptCSS.ppt
CSS.ppt
 
lecture CSS 1-2_2022_2023.pptx
lecture CSS 1-2_2022_2023.pptxlecture CSS 1-2_2022_2023.pptx
lecture CSS 1-2_2022_2023.pptx
 
Css
CssCss
Css
 
Css
CssCss
Css
 

Más de Mike Crabb

Hard to Reach Users in Easy to Reach Places
Hard to Reach Users in Easy to Reach PlacesHard to Reach Users in Easy to Reach Places
Hard to Reach Users in Easy to Reach PlacesMike Crabb
 
Accessible and Assistive Interfaces
Accessible and Assistive InterfacesAccessible and Assistive Interfaces
Accessible and Assistive InterfacesMike Crabb
 
Accessible Everyone
Accessible EveryoneAccessible Everyone
Accessible EveryoneMike Crabb
 
The Peer Review Process
The Peer Review ProcessThe Peer Review Process
The Peer Review ProcessMike Crabb
 
Managing Quality In Qualitative Research
Managing Quality In Qualitative ResearchManaging Quality In Qualitative Research
Managing Quality In Qualitative ResearchMike Crabb
 
Analysing Qualitative Data
Analysing Qualitative DataAnalysing Qualitative Data
Analysing Qualitative DataMike Crabb
 
Conversation Discourse and Document Analysis
Conversation Discourse and Document AnalysisConversation Discourse and Document Analysis
Conversation Discourse and Document AnalysisMike Crabb
 
Ethnographic and Observational Research
Ethnographic and Observational ResearchEthnographic and Observational Research
Ethnographic and Observational ResearchMike Crabb
 
Doing Focus Groups
Doing Focus GroupsDoing Focus Groups
Doing Focus GroupsMike Crabb
 
Doing Interviews
Doing InterviewsDoing Interviews
Doing InterviewsMike Crabb
 
Designing Qualitative Research
Designing Qualitative ResearchDesigning Qualitative Research
Designing Qualitative ResearchMike Crabb
 
Introduction to Accessible Design
Introduction to Accessible DesignIntroduction to Accessible Design
Introduction to Accessible DesignMike Crabb
 
Accessible Everyone
Accessible EveryoneAccessible Everyone
Accessible EveryoneMike Crabb
 
Texture and Glyph Design
Texture and Glyph DesignTexture and Glyph Design
Texture and Glyph DesignMike Crabb
 
Pattern Perception and Map Design
Pattern Perception and Map DesignPattern Perception and Map Design
Pattern Perception and Map DesignMike Crabb
 
Dealing with Enterprise Level Data
Dealing with Enterprise Level DataDealing with Enterprise Level Data
Dealing with Enterprise Level DataMike Crabb
 
Using Cloud in an Enterprise Environment
Using Cloud in an Enterprise EnvironmentUsing Cloud in an Enterprise Environment
Using Cloud in an Enterprise EnvironmentMike Crabb
 
Teaching Cloud to the Programmers of Tomorrow
Teaching Cloud to the Programmers of TomorrowTeaching Cloud to the Programmers of Tomorrow
Teaching Cloud to the Programmers of TomorrowMike Crabb
 
Using mySQL in PHP
Using mySQL in PHPUsing mySQL in PHP
Using mySQL in PHPMike Crabb
 
Creating a Webpage from a Template
Creating a Webpage from a TemplateCreating a Webpage from a Template
Creating a Webpage from a TemplateMike Crabb
 

Más de Mike Crabb (20)

Hard to Reach Users in Easy to Reach Places
Hard to Reach Users in Easy to Reach PlacesHard to Reach Users in Easy to Reach Places
Hard to Reach Users in Easy to Reach Places
 
Accessible and Assistive Interfaces
Accessible and Assistive InterfacesAccessible and Assistive Interfaces
Accessible and Assistive Interfaces
 
Accessible Everyone
Accessible EveryoneAccessible Everyone
Accessible Everyone
 
The Peer Review Process
The Peer Review ProcessThe Peer Review Process
The Peer Review Process
 
Managing Quality In Qualitative Research
Managing Quality In Qualitative ResearchManaging Quality In Qualitative Research
Managing Quality In Qualitative Research
 
Analysing Qualitative Data
Analysing Qualitative DataAnalysing Qualitative Data
Analysing Qualitative Data
 
Conversation Discourse and Document Analysis
Conversation Discourse and Document AnalysisConversation Discourse and Document Analysis
Conversation Discourse and Document Analysis
 
Ethnographic and Observational Research
Ethnographic and Observational ResearchEthnographic and Observational Research
Ethnographic and Observational Research
 
Doing Focus Groups
Doing Focus GroupsDoing Focus Groups
Doing Focus Groups
 
Doing Interviews
Doing InterviewsDoing Interviews
Doing Interviews
 
Designing Qualitative Research
Designing Qualitative ResearchDesigning Qualitative Research
Designing Qualitative Research
 
Introduction to Accessible Design
Introduction to Accessible DesignIntroduction to Accessible Design
Introduction to Accessible Design
 
Accessible Everyone
Accessible EveryoneAccessible Everyone
Accessible Everyone
 
Texture and Glyph Design
Texture and Glyph DesignTexture and Glyph Design
Texture and Glyph Design
 
Pattern Perception and Map Design
Pattern Perception and Map DesignPattern Perception and Map Design
Pattern Perception and Map Design
 
Dealing with Enterprise Level Data
Dealing with Enterprise Level DataDealing with Enterprise Level Data
Dealing with Enterprise Level Data
 
Using Cloud in an Enterprise Environment
Using Cloud in an Enterprise EnvironmentUsing Cloud in an Enterprise Environment
Using Cloud in an Enterprise Environment
 
Teaching Cloud to the Programmers of Tomorrow
Teaching Cloud to the Programmers of TomorrowTeaching Cloud to the Programmers of Tomorrow
Teaching Cloud to the Programmers of Tomorrow
 
Using mySQL in PHP
Using mySQL in PHPUsing mySQL in PHP
Using mySQL in PHP
 
Creating a Webpage from a Template
Creating a Webpage from a TemplateCreating a Webpage from a Template
Creating a Webpage from a Template
 

Último

Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfStefano Stabellini
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commercemanigoyal112
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...OnePlan Solutions
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Natan Silnitsky
 
How To Manage Restaurant Staff -BTRESTRO
How To Manage Restaurant Staff -BTRESTROHow To Manage Restaurant Staff -BTRESTRO
How To Manage Restaurant Staff -BTRESTROmotivationalword821
 
PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentationvaddepallysandeep122
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Developmentvyaparkranti
 
Post Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on IdentityPost Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on Identityteam-WIBU
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceBrainSell Technologies
 
Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Rob Geurden
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesŁukasz Chruściel
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...confluent
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Velvetech LLC
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...Technogeeks
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf31events.com
 
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...Akihiro Suda
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprisepreethippts
 

Último (20)

Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdf
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commerce
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
 
How To Manage Restaurant Staff -BTRESTRO
How To Manage Restaurant Staff -BTRESTROHow To Manage Restaurant Staff -BTRESTRO
How To Manage Restaurant Staff -BTRESTRO
 
PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentation
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Development
 
Post Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on IdentityPost Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on Identity
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. Salesforce
 
Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf
 
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprise
 

CSS Guide for Styling Web Pages

  • 2. overview purpose of css syntax of css benefits of css APPLYING CSS USING CSS WITH HTML CSS Selectors Pseudo Selectors CSS Values and Units
  • 4. HTML IS USED TO SPECIFY CONTENT AND STRUCTURE • CONTENT: TEXT IN PARAGRAPHS, DATA IN TABLES, IMAGES AND OTHER MEDIA • STRUCTURE: LOGICAL FLOW OF PAGE COMPONENTS CONTAINING CONTENT (E.G. DIVS, SECTIONS HEADERS ETC.) overview CASCADING STYLE SHEETS (CSS) ARE USED TO SPECIFY THE PRESENTATION STYLE AND LAYOUT OF ELEMENTS WITHIN AN HTML PAGE • DISTINCT WEB TECHNOLOGY • NOT PROGRAMMING OR MARK-UP LANGUAGE • SIMPLE A SEQUENCE OF RULES TO APPLY
  • 5. CSS DECLARES RULES THAT: • SELECT WHICH HTML ELEMENTS SHOULD BE STYLED • SPECIFY THE PROPERTIES TO MANIPULATE • GIVE VALUES TO THESE PROPERTIES OPERATION WEB BROWSERS COMBINE HTML AND CSS TO RENDER A COMPLETE WEB PAGE • BOTH MUST BE LINKED TOGETHER
  • 6. • SORT BY SPECIFICITY ALL DECLARATIONS APPLYING TO A GIVEN ELEMENT. • THOSE ELEMENTS WITH A HIGHER SPECIFICITY HAVE MORE WEIGHT THAN THOSE WITH LOWER SPECIFICITY • SORT BY ORDER ALL DECLARATIONS APPLYING TO A GIVEN ELEMENT. • THE LATER A DECLARATION APPEARS IN THE STYLE SHEET OR DOCUMENT, THE MORE WEIGHT IT IS GIVEN • DECLARATIONS THAT APPEAR IN AN IMPORTED STYLE SHEET ARE CONSIDERED TO COME BEFORE ALL DECLARATIONS WITHIN THE STYLE SHEET THAT IMPORTS THEM. cascading rules
  • 7. cascading rules default browser styles user style styles author style sheet Author embedded styles Author inline styles
  • 9. FIND EVERY <H2> ELEMENT ON A PAGE (SELECT) SPECIFY THAT ITS COLOUR (PROPERTY) SHOULD BE BLUE (VALUE) EXAMPLE H2 { COLOR: “BLUE”; }
  • 10. CSS SYNTAX PATTERN SELECTOR1 { PROPERTY: “VALUE”; } SELECTOR2 { PROPERTY1: “VALUE”; PROPERTY2: “VALUE”; PROPERTY: “VALUE”; }
  • 11. SYNTAX RULES TO REMEMBER SELECTOR1 { PROPERTY: “VALUE”; }
  • 12. SYNTAX RULES TO REMEMBER SELECTOR1 { PROPERTY: “VALUE”; } 1. SELECTOR IDENTIFIES THE HTML ELEMENTS THAT THE RULE(S) WILL BE APPLIED TO
  • 13. SYNTAX RULES TO REMEMBER SELECTOR1 { PROPERTY: “VALUE”; } 1. SELECTOR IDENTIFIES THE HTML ELEMENTS THAT THE RULE(S) WILL BE APPLIED TO 2. CURLY BRACKETS CONTAIN ALL OF THE RULES FOR THIS SELECTOR
  • 14. SYNTAX RULES TO REMEMBER SELECTOR1 { PROPERTY: “VALUE”; } 1. SELECTOR IDENTIFIES THE HTML ELEMENTS THAT THE RULE(S) WILL BE APPLIED TO 2. CURLY BRACKETS CONTAIN ALL OF THE RULES FOR THIS SELECTOR 3. RULES ARE SEPARATED BY A SEMICOLON
  • 15. SYNTAX RULES TO REMEMBER SELECTOR1 { PROPERTY: “VALUE”; } 1. SELECTOR IDENTIFIES THE HTML ELEMENTS THAT THE RULE(S) WILL BE APPLIED TO 2. CURLY BRACKETS CONTAIN ALL OF THE RULES FOR THIS SELECTOR 3. RULES ARE SEPARATED BY A SEMICOLON 4. THE PROPERTY OF A RULE DEFINES WHAT ASPECT OF THE ELEMENT WILL BE AFFECTED 1. COLOUR, FONT, POSITION, BORDERS ETC.)
  • 16. SYNTAX RULES TO REMEMBER SELECTOR1 { PROPERTY: “VALUE”; } 1. SELECTOR IDENTIFIES THE HTML ELEMENTS THAT THE RULE(S) WILL BE APPLIED TO 2. CURLY BRACKETS CONTAIN ALL OF THE RULES FOR THIS SELECTOR 3. RULES ARE SEPARATED BY A SEMICOLON 4. THE PROPERTY OF A RULE DEFINES WHAT ASPECT OF THE ELEMENT WILL BE AFFECTED 1. COLOUR, FONT, POSITION, BORDERS ETC.) 5. THE VALUE OF A RULE SPECIFIES HOW THE PROPERTY WILL BE AFFECTED
  • 17. SYNTAX RULES TO REMEMBER SELECTOR1 { PROPERTY: “VALUE”; } 1. SELECTOR IDENTIFIES THE HTML ELEMENTS THAT THE RULE(S) WILL BE APPLIED TO 2. CURLY BRACKETS CONTAIN ALL OF THE RULES FOR THIS SELECTOR 3. RULES ARE SEPARATED BY A SEMICOLON 4. THE PROPERTY OF A RULE DEFINES WHAT ASPECT OF THE ELEMENT WILL BE AFFECTED 1. COLOUR, FONT, POSITION, BORDERS ETC.) 5. THE VALUE OF A RULE SPECIFIES HOW THE PROPERTY WILL BE AFFECTED 6. PROPERTIES AND THEIR VALUES ARE SEPARATED BY A COLON
  • 18. TABLE { WIDTH: 80%; MARGIN: 0; BACKGROUND: #FFFFFF; BORDER: 1PX SOLID #333333; } STYLE.CSS <TABLE> <CAPTION>THIS IS MY TABLE CAPTION</CAPTION> </TABLE> INDEX.HTML
  • 20. OVERCOMES THE LIMITATIONS OF ADDING STYLE USING HTML ALONE • BASIC TABLES AND FORMS VERY SIMPLE WEB TECHNOLOGY (IN TERMS OF SYNTAX) YET VERY POWERFUL • ENDLESS COMBINATIONS OF RULES FOR ELEMENTS BENEFITS OF CSS
  • 24. • CASCADING STYLE SHEETS (CSS) IS A METHOD OF SEPARATING A PAGE’S STRUCTURE AND CONTENT FROM ITS PRESENTATION • CSS ALLOWS FOR A MUCH RICHER PAGE APPEARANCE THAN WITH HTML ALONE (NO MORE TABLES) • CSS CAN SAVE TIME AS THE APPEARANCE OF THE ENTIRE PAGE APP CAN BE CREATED AND CHANGED IN JUST ONE PLACE • CSS CAN IMPROVE LOAD TIMES AS IT COMPACTLY STORES THE PRESENTATION CONCERNS OF A PAGE IN ONE PLACE INSTEAD OF BEING REPEATED THROUGHOUT THE PAGE benefits of css
  • 25. • THERE ARE DIFFERENT SELECTOR RULES BEYOND SIMPLE ELEMENTS • THERE ARE LOTS OF PROPERTIES AND THEY VARY ACROSS DIFFERENT HTML ELEMENTS • THERE ARE MANY PROPERTY/VALUE COMBINATIONS; NOT ALL OF WHICH WORK AS EXPECTED CHALLENGES OF CSS
  • 27. • STYLESHEETS DESCRIBE THE RENDERING OF HTML ELEMENTS • THEY SPECIFY STYLISTIC ASPECTS OF INDIVIDUAL ELEMENTS OR ALL ELEMENTS OF A PARTICULAR KIND • A CSS CONSISTS OF A SET OF FORMATTING RULES, WHICH ARE SPECIFIED IN THE FOLLOWING WAY: APPLYING CSS SELECTOR2 { PROPERTY1: “VALUE”; PROPERTY2: “VALUE”; PROPERTY: “VALUE”; }
  • 28. APPLYING STYLESSELECTOR2 { PROPERTY1: “VALUE”; PROPERTY2: “VALUE”; PROPERTY: “VALUE”; } P { FONT-SIZE: 12PT; FONT-FAMILY: “VERDANA”; } APPLIES TO ALL <P> ELEMENTS H1, H2, H3 { COLOR: RED; FONT-SIZE: 18PX; } APPLIES TO ALL <H1>,<H2>, AND <H3> ELEMENTS
  • 29. APPLYING STYLESSELECTOR2 { PROPERTY1: “VALUE”; PROPERTY2: “VALUE”; PROPERTY: “VALUE”; } * { TEXT-ALIGN: LEFT; } APPLIES TO ALL ELEMENTS #MENU A { PADDING: 45PX 25PX 0PX 0PX; B0RDER: NONE; } APPLIES TO ALL <A> ELEMENTS WITH ID=“MENU
  • 30. APPLYING STYLESSELECTOR2 { PROPERTY1: “VALUE”; PROPERTY2: “VALUE”; PROPERTY: “VALUE”; } .menu { PADDING: 100PX; } APPLIES TO ALL ELEMENTS WITH CLASS=MENU LOTS MORE EXIST…HERES A GOOD REFERENCE http://www.w3schools.com/cssref/css_selectors.asp
  • 31. USING CSS WITH HTML APPLYING CSS
  • 32. • INLINE: STYLE INFORMATION IS ADDED DIRECTLY TO ONE PARTICULAR ELEMENT USING ITS STYLE ATTRIBUTE • CSS SYNTAX IS USED AFTER THE STYLE ATTRIBUTE IN AN HTML TAG • THIS ONLY EFFECTS THIS ELEMENT, 
 OTHERS OF THE SAME TYPE ARE NOT EFFECTED. • USEFUL TO OVERRIDE EXISTING STYLE, BUT BREAKS THE SEPARATION OF CONTENT AND PRESENTATION INLINE CSS SPECIFICATION <H3 STYLE=“COLOUR: GREEN; FONT-SIZE: 18PT”>
  • 33. • EMBEDDED: STYLE RULES CAN BE SPECIFIED IN THE <HEAD> SECTION OF THE PAGE • THESE RULES WILL BE APPLIED TO THE ENTIRE PAGE EMBEDDED CSS SPECIFICATION <html> <head> <style> h3 { color: yellow; font-size: 18pt; } </style> </head> <body> <h3> This will be yellow font size 18 </h3> … </body> </html>
  • 34. • EXTERNAL: IN A SEPARATE FILE WHICH CAN BE SHARED BY SEVERAL PAGES. THE FILE EXTENSION IS “.CSS” • THIS IS PERHAPS THE BEST METHOD IN TERMS OF: • SEPARATION OF CONCERNS • MAINTENANCE • PERFORMANCE EXTERNAL CSS SPECIFICATION <head> <link rel="stylesheet" href="master.css" type="text/ css"> </head>
  • 36. • CLASS AND ID SELECTORS CAN BE USED FOR FINER CONTROL • THIS INVOLVES MORE PLANNING/EFFORT WITH PAGE MARKUP • BUT CAN RESULT IN A BETTER USER EXPERIENCE • IT IS ALSO VERY IMPORTANT FOR MANIPULATING ELEMENTS IN JAVASCRIPT • THE EFFORT ALSO PAYS OFF IF YOU USE LIBRARIES LIKE JQUERY SPECIALISATION OF PRESENTATION
  • 37. • USED TO DEFINE A SPECIAL CASE FOR AN ELEMENT • IDS ARE MEANT TO UNIQUE AND ONLY USED ONCE • HOWEVER, SOME BROWSERS ARE NOT PARTICULARLY FUSSY ID SELECTORS #first-para { font-weight: bold; } <p id=“first-para”>This paragraph will be bold- faced</p> <p>This will not be bold</p>
  • 38. class SELECTORS .warning { font-weight: bold; } <p class="warning">This text will be displayed in bold.</p> <p>This text will NOT be displayed in bold.</p> • CLASS SELECTOR ALLOW YOU TO STYLE ITEMS WITH THE SAME HTML ELEMENT DIFFERENTLY • THEY WORK WHEN THE CLASS ATTRIBUTE OF AN HTML TAG IS GIVEN A NAME • USED TO STYLE MANY HTML ELEMENTS
  • 39. TAG SELECTORS h1 { color: green; } p { color: red; } <h1>This will be green</h1> <p>This will be red</p> • USED TO STYLE SPECIFIC TAGS
  • 40. grouping h1, h2, h3 { color: green; } p { color: red; } <h1>This will be green</h1> <h2>So will this</h2> <h3>and so will this</h3> <p>This will be red</p> • MULTIPLE SELECTORS CAN BE GROUPED TOGETHER
  • 41. descendant selectors section.news h1 { color: green; } <section class=news> <div> <h1>This will be green</ h1> </div> </section> • USED TO SELECT ELEMENTS THAT ARE DECEDENTS OF THE ELEMENT IN THE DOCUMENT TREE • NOT NECESSARILY DIRECT CHILDREN
  • 42. child selectors section.news > h1 { color: green; } <section class=news> <div> <h1>This will not be green</h1> </div> </section> • USED TO SELECT CHILD ELEMENTS THAT ARE DECEDENTS OF THE ELEMENT IN THE DOCUMENT TREE <section id=news> <h1>This will be green</h1> </section>
  • 43. adjacent sibling selectors h1 + h2 { color: green; } <h1>Green</h1> <h2>Green</h2> <p>Not Green</p> • SELECT THE SIBLING ELEMENT DIRECTLY FOLLOWING ANOTHER ELEMENT <h1>Not Green</h1> <p>Not Green</p> <h2>Not Green</h2>
  • 44. universal selectors * { color: blue; } <h1>This is blue</h1> <p>This is blue</p> <ul> <li>All the things are blue</li> </ul> • USED TO SELECT ELEMENTS THAT ARE DECEDENTS OF THE ELEMENT IN THE DOCUMENT TREE • NOT NECESSARILY DIRECT CHILDREN
  • 46. • WE CAN APPLY EVEN MORE DETAILED CSS TO ELEMENTS THROUGH THE USE OF PSEUDO CLASSES • CAN BE USED TO: • STYLE AN ELEMENT WHEN A MOUSE IS OVER IT • STYLE VISITED AND UNVISITED LINKS • STYLE A FOCUSED ELEMENT pseudo elements
  • 47. colouring links /* MOUSE OVER LINK */ A:HOVER { COLOR: #FF00FF; } /* SELECTED LINK */ A:ACTIVE { COLOR: #0000FF; } /* UNVISITED LINK */ A:LINK { COLOR: #FF0000; } /* VISITED LINK */ A:VISITED { COLOR: #00FF00; }
  • 48. other pseudo elements :AFTER :BEFORE :FIRST-CHILD :FOCUS :FIRST-LETTER :FIRST-LINE :LANG • MORE EXISTS BUT FOR THE MOST PART YOU’LL WANT TO USE THE ONES THAT CAN COLOUR LINKS.
  • 49. CSS Values and Units APPLYING CSS
  • 50. • WORDS • AFFECT THE COLOURS, DISTANCES, AND SIZES OF A WHOLE HOST OF PROPERTIES OF AN ELEMENTS STYLE • TEXT-ALIGN: CENTRE; VALUES AND UNITS
  • 51. • NUMERICAL VALUES • NORMALLY FOLLOWED BY A UNIT TYPE • LENGTH UNITS • INCHES (IN) • CENTIMETERS (CM) • MILLIMETERS (MM) • POINTS (PT) • PICAS (PI) • RELATIVE UNITS • EM IS RELATIVE TO THE GIVEN FONT-SIZE VALUE • E.G. FONT SIZE IS 14PX, 1EM=14PX • PX IS (SHOULD) BE THE SIZE OF A PIXEL ON THE MONITOR • GENERALLY THE RECOMMENDED UNIT TO USE VALUES AND UNITS
  • 52. • COLOUR • NAMED COLOURS (RED) • FUNCTIONAL RGB (255,0,0) • HEXADECIMAL RGU CODES (#FF0000) VALUES AND UNITS
  • 53. recap purpose of css syntax of css benefits of css APPLYING CSS USING CSS WITH HTML CSS Selectors Pseudo Selectors CSS Values and Units