SlideShare a Scribd company logo
Style CSS and Selector
By Yaowaluck Promdee, Sumonta Kasemvilas
322432 Web Design Technology
Computer Science Khon Kaen University
HOME INDEX CSS BASIC CSS SYNTAX HOW TO SELECTOR ASSIGNMENT
WDS
CS KKU
(C) Web Design Technology 2015 1
Index
•  CSS Basic
•  CSS Syntax
•  How to use Style Sheet
•  Selectors
•  Assignment
HOME INDEX CSS BASIC CSS SYNTAX HOW TO SELECTOR
WDS
CS KKU
(C) Web Design Technology 2015 2
ASSIGNMENT
HOME INDEX CSS BASIC CSS SYNTAX HOW TO SELECTOR
WDS
CS KKU
What is CSS?
Single Source of HTML
Web Browser
Other Media
Print Output
Server
Clients
Formatting data for multiple destination
Cascading Style Sheets (CSS) is a style
sheet language used for describing
the look and formatting of a document
written in a markup language.
CSS Style Sheet
(C) Web Design Technology 2015 3
CSS BASIC > WHAT IS CSS
ASSIGNMENT
HOME INDEX CSS BASIC CSS SYNTAX HOW TO SELECTOR
WDS
CS KKU
http://ryanstutorials.net/css-tutorial/img/css_flexibility.png
CSS is
a language for describing the look and formatting of
content.
The selector identifies which parts of the content the
rules should apply to. The rules that are inside the
opening and closing curly brackets ( { } ) are applied
to any items matching the selector.
selector {
property: value;
property: value; }
/* This is comments */
(C) Web Design Technology 2015 4
CSS BASIC > CSS IS A
ASSIGNMENT
HOME INDEX CSS BASIC CSS SYNTAX HOW TO SELECTOR
WDS
CS KKU
(C) Web Design Technology 2015 5
selector { property:value }
selector { property1:value1; property2:value2 }
h1 { color:red; font-size:12px; }
Selector Declaration
Property PropertyValue Value
ASSIGNMENT
HOME INDEX CSS BASIC CSS SYNTAX HOW TO SELECTOR
WDS
CS KKU
(C) Web Design Technology 2015 6
Three Ways to Insert CSS
1.  Inline Style
2. Internal Style Sheet
3. External Style Sheet
How to inserting a style sheet
ASSIGNMENT
HOME INDEX CSS BASIC CSS SYNTAX HOW TO SELECTOR
WDS
CS KKU
(C) Web Design Technology 2015 7
1. Inline Style
HOW TO > INLINE STYLE
Example
<!DOCTYPE html>
<html>
<body>
<h1 style="color:blue;margin-left:30px;">This is a
heading.</h1>
<p>This is a paragraph.</p>
</body>
</html>
An inline style may be used to
apply a unique style for a single
element.
An inline style loses many of the
advantages of a style sheet (by
mixing content with presentation).
Use this method sparingly
<Tag style="property:value;">
ASSIGNMENT
HOME INDEX CSS BASIC CSS SYNTAX HOW TO SELECTOR
WDS
CS KKU
(C) Web Design Technology 2015 8
2. Internal Style sheet
HOW TO > INTERNAL STYLE SHEET
<style type="text/css">
<!--selector {property1: value1; property2: value2}... -->
</style>
An internal style sheet should be used when a single document has a unique style.
You define internal styles in the head section of an HTML page, inside the <style>
tag
body { background-color: linen; }
h1 { color: maroon; margin-left: 40px; }
ASSIGNMENT
HOME INDEX CSS BASIC CSS SYNTAX HOW TO SELECTOR
WDS
CS KKU
(C) Web Design Technology 2015 9
3. External Style sheet
HOW TO > EXTERNAL STYLE SHEET
<link rel="stylesheet" type="text/css" href="URL file.css">
<!DOCTYPE html><html> <head>
<link rel="stylesheet" type="text/css" href="mystyle.css">
</head>
<body> </body> </html>
An external style sheet is ideal when the style is applied to many pages. With an external
style sheet, you can change the look of an entire Web site by changing just one file.
Each page must include a link to the style sheet with the <link> tag. The <link> tag goes
inside the head section:
ASSIGNMENT
HOME INDEX CSS BASIC CSS SYNTAX HOW TO SELECTOR
WDS
CS KKU
(C) Web Design Technology 2015 10
CSS Selector
SELECTOR > CSS SELECTOR
Element Selector ID Selector Class Selector
ASSIGNMENT
HOME INDEX CSS BASIC CSS SYNTAX HOW TO SELECTOR
WDS
CS KKU
(C) Web Design Technology 2015 11
SELECTOR > CSS SELECTOR > ELEMENT SELECTOR
The element selector selects elements based on the element name.
1. Element Selector
p {
    text-align: center;
    color: red;
}
<p>Example1</p>
<h1>Example2</h1>
<p>Example3</p>
Result
---------------------------------------
Example1
Example2
Example3
ASSIGNMENT
HOME INDEX CSS BASIC CSS SYNTAX HOW TO SELECTOR
WDS
CS KKU
(C) Web Design Technology 2015 12
SELECTOR > CSS SELECTOR > ID SELECTOR
2. ID Selector
The id selector uses the id attribute of an HTML tag to find the specific element.
An id should be unique within a page, so you should use the id selector when you
want to find a single, unique element.
#paragraph {
    text-align: center;
    color: red;
}
<p id="paragraph">Hello World!</p>
<p>This paragraph is not affected by the
style.</p>
ASSIGNMENT
HOME INDEX CSS BASIC CSS SYNTAX HOW TO SELECTOR
WDS
CS KKU
(C) Web Design Technology 2015 13
SELECTOR > CSS SELECTOR > CLASS SELECTOR
3. Class Selector
.center {
text-align: center;
color: red; }
<h1 class="center">sentence1</h1>
<p class="center">sentence2</p>
The class selector finds elements with the specific class.
The class selector uses the HTML class attribute.
To find elements with a specific class, write a period character, followed by the name of the
class:
ASSIGNMENT
HOME INDEX CSS BASIC CSS SYNTAX HOW TO SELECTOR
WDS
CS KKU
(C) Web Design Technology 2015 14
ASSIGNMENT
Example 2
SELECTOR > CSS SELECTOR > CLASS SELECTOR > EXAMPLE
<h1>This is a heading</h1>
<h2>This is a smaller heading</h2>
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
How to write CSS?
Answer:
Try it!
Change the color of all <p> and <h1> elements, to “blue”, and h1 is bold font.
Group the selectors to minimize code.
HOME INDEX CSS BASIC CSS SYNTAX HOW TO SELECTOR
WDS
CS KKU
(C) Web Design Technology 2015 15
ASSIGNMENT
Example Selector Class attribute
SELECTOR > CSS SELECTOR > CLASS SELECTOR > EXAMPLE
p.center {
text-align: center;
color: red;
font-weight:bold;
}
<h1 class="center">This heading </h1>
<p class="center">This paragraph will be red
and center-aligned.</p>
Try it!
HOME INDEX CSS BASIC CSS SYNTAX HOW TO SELECTOR ASSIGNMENT
WDS
CS KKU
(C) Web Design Technology 2015 16
Assignment#5 Style and Selectors
Create a Webpage to present your two favorite movies
using CSS (eg. all selectors in class today: element, class,
id sector) and you must comment your own CSS code.
Grade will be based on your CSS technique and look and
feel of the Web page.

More Related Content

What's hot

CSS Transitions, Transforms, Animations
CSS Transitions, Transforms, Animations CSS Transitions, Transforms, Animations
CSS Transitions, Transforms, Animations Rob LaPlaca
 
How Cascading Style Sheets (CSS) Works
How Cascading Style Sheets (CSS) WorksHow Cascading Style Sheets (CSS) Works
How Cascading Style Sheets (CSS) WorksAmit Tyagi
 
Cascading Style Sheets (CSS) help
Cascading Style Sheets (CSS) helpCascading Style Sheets (CSS) help
Cascading Style Sheets (CSS) helpcasestudyhelp
 
CSS3, Media Queries, and Responsive Design
CSS3, Media Queries, and Responsive DesignCSS3, Media Queries, and Responsive Design
CSS3, Media Queries, and Responsive DesignZoe Gillenwater
 
Flexbox and Grid Layout
Flexbox and Grid LayoutFlexbox and Grid Layout
Flexbox and Grid LayoutRachel Andrew
 
Introduction to HTML
Introduction to HTMLIntroduction to HTML
Introduction to HTMLAjay Khatri
 
Introduction to Cascading Style Sheets (CSS)
Introduction to Cascading Style Sheets (CSS)Introduction to Cascading Style Sheets (CSS)
Introduction to Cascading Style Sheets (CSS)Chris Poteet
 
CSS Day: CSS Grid Layout
CSS Day: CSS Grid Layout CSS Day: CSS Grid Layout
CSS Day: CSS Grid Layout Rachel Andrew
 
CSS - OOCSS, SMACSS and more
CSS - OOCSS, SMACSS and moreCSS - OOCSS, SMACSS and more
CSS - OOCSS, SMACSS and moreRuss Weakley
 
Elements of html powerpoint
Elements of html powerpointElements of html powerpoint
Elements of html powerpointAnastasia1993
 
Introduction to HTML and CSS
Introduction to HTML and CSSIntroduction to HTML and CSS
Introduction to HTML and CSSMario Hernandez
 
New Elements & Features in CSS3
New Elements & Features in CSS3New Elements & Features in CSS3
New Elements & Features in CSS3Jamshid Hashimi
 

What's hot (20)

Design sitemap
Design sitemapDesign sitemap
Design sitemap
 
Good/Bad Web Design
Good/Bad Web DesignGood/Bad Web Design
Good/Bad Web Design
 
CSS Transitions, Transforms, Animations
CSS Transitions, Transforms, Animations CSS Transitions, Transforms, Animations
CSS Transitions, Transforms, Animations
 
Html5 semantics
Html5 semanticsHtml5 semantics
Html5 semantics
 
How Cascading Style Sheets (CSS) Works
How Cascading Style Sheets (CSS) WorksHow Cascading Style Sheets (CSS) Works
How Cascading Style Sheets (CSS) Works
 
Cascading Style Sheets (CSS) help
Cascading Style Sheets (CSS) helpCascading Style Sheets (CSS) help
Cascading Style Sheets (CSS) help
 
CSS Lists and Tables
CSS Lists and TablesCSS Lists and Tables
CSS Lists and Tables
 
CSS3, Media Queries, and Responsive Design
CSS3, Media Queries, and Responsive DesignCSS3, Media Queries, and Responsive Design
CSS3, Media Queries, and Responsive Design
 
Flexbox and Grid Layout
Flexbox and Grid LayoutFlexbox and Grid Layout
Flexbox and Grid Layout
 
Introduction to HTML
Introduction to HTMLIntroduction to HTML
Introduction to HTML
 
Introduction to Cascading Style Sheets (CSS)
Introduction to Cascading Style Sheets (CSS)Introduction to Cascading Style Sheets (CSS)
Introduction to Cascading Style Sheets (CSS)
 
Advanced Cascading Style Sheets
Advanced Cascading Style SheetsAdvanced Cascading Style Sheets
Advanced Cascading Style Sheets
 
CSS Day: CSS Grid Layout
CSS Day: CSS Grid Layout CSS Day: CSS Grid Layout
CSS Day: CSS Grid Layout
 
CSS - OOCSS, SMACSS and more
CSS - OOCSS, SMACSS and moreCSS - OOCSS, SMACSS and more
CSS - OOCSS, SMACSS and more
 
CSS
CSSCSS
CSS
 
Css
CssCss
Css
 
Elements of html powerpoint
Elements of html powerpointElements of html powerpoint
Elements of html powerpoint
 
Introduction to HTML and CSS
Introduction to HTML and CSSIntroduction to HTML and CSS
Introduction to HTML and CSS
 
CSS Best practice
CSS Best practiceCSS Best practice
CSS Best practice
 
New Elements & Features in CSS3
New Elements & Features in CSS3New Elements & Features in CSS3
New Elements & Features in CSS3
 

Viewers also liked (7)

Game design
Game designGame design
Game design
 
Web Interface
Web InterfaceWeb Interface
Web Interface
 
HTML 5
HTML 5HTML 5
HTML 5
 
Style and Selector Part2
Style and Selector Part2Style and Selector Part2
Style and Selector Part2
 
Overview HTML, HTML5 and Validations
Overview HTML, HTML5 and Validations Overview HTML, HTML5 and Validations
Overview HTML, HTML5 and Validations
 
Bootstrap Framework
Bootstrap Framework Bootstrap Framework
Bootstrap Framework
 
Observation and interviewing
Observation and interviewingObservation and interviewing
Observation and interviewing
 

Similar to Style and Selector

Act 06 - CSS para aplicaciones web y responsibo
Act 06 - CSS para aplicaciones web y responsiboAct 06 - CSS para aplicaciones web y responsibo
Act 06 - CSS para aplicaciones web y responsiboAlexBaldeon2
 
Css training tutorial css3 &amp; css4 essentials
Css training tutorial css3 &amp; css4 essentialsCss training tutorial css3 &amp; css4 essentials
Css training tutorial css3 &amp; css4 essentialsQA TrainingHub
 
Lecture 3CSS part 1.pptx
Lecture 3CSS part 1.pptxLecture 3CSS part 1.pptx
Lecture 3CSS part 1.pptxGmachImen
 
New Css style
New Css styleNew Css style
New Css styleBUDNET
 
Chapter 4a cascade style sheet css
Chapter 4a cascade style sheet cssChapter 4a cascade style sheet css
Chapter 4a cascade style sheet cssTesfaye Yenealem
 
IP - Lecture 6, 7 Chapter-3 (3).ppt
IP - Lecture 6, 7 Chapter-3 (3).pptIP - Lecture 6, 7 Chapter-3 (3).ppt
IP - Lecture 6, 7 Chapter-3 (3).pptkassahungebrie
 
Teaching presentation
Teaching presentationTeaching presentation
Teaching presentationjakia123
 
Web Design Course: CSS lecture 1
Web Design Course: CSS lecture 1Web Design Course: CSS lecture 1
Web Design Course: CSS lecture 1Gheyath M. Othman
 
Lecture 9 CSS part 1.pptxType Classification
Lecture 9 CSS part 1.pptxType ClassificationLecture 9 CSS part 1.pptxType Classification
Lecture 9 CSS part 1.pptxType ClassificationZahouAmel1
 
Cascading Style Sheets
Cascading Style SheetsCascading Style Sheets
Cascading Style SheetsMukesh Tekwani
 
Vskills certified css designer Notes
Vskills certified css designer NotesVskills certified css designer Notes
Vskills certified css designer NotesVskills
 
MYSQL DATABASE MYSQL DATABASE MYSQL DATABASECSS.pptx
MYSQL DATABASE MYSQL DATABASE MYSQL DATABASECSS.pptxMYSQL DATABASE MYSQL DATABASE MYSQL DATABASECSS.pptx
MYSQL DATABASE MYSQL DATABASE MYSQL DATABASECSS.pptxArjayBalberan1
 

Similar to Style and Selector (20)

Css.html
Css.htmlCss.html
Css.html
 
Act 06 - CSS para aplicaciones web y responsibo
Act 06 - CSS para aplicaciones web y responsiboAct 06 - CSS para aplicaciones web y responsibo
Act 06 - CSS para aplicaciones web y responsibo
 
Css training tutorial css3 &amp; css4 essentials
Css training tutorial css3 &amp; css4 essentialsCss training tutorial css3 &amp; css4 essentials
Css training tutorial css3 &amp; css4 essentials
 
Lecture-6.pptx
Lecture-6.pptxLecture-6.pptx
Lecture-6.pptx
 
Lecture 3CSS part 1.pptx
Lecture 3CSS part 1.pptxLecture 3CSS part 1.pptx
Lecture 3CSS part 1.pptx
 
New Css style
New Css styleNew Css style
New Css style
 
Chapter 4a cascade style sheet css
Chapter 4a cascade style sheet cssChapter 4a cascade style sheet css
Chapter 4a cascade style sheet css
 
INTRODUCTIONS OF CSS
INTRODUCTIONS OF CSSINTRODUCTIONS OF CSS
INTRODUCTIONS OF CSS
 
Css
CssCss
Css
 
Css
CssCss
Css
 
IP - Lecture 6, 7 Chapter-3 (3).ppt
IP - Lecture 6, 7 Chapter-3 (3).pptIP - Lecture 6, 7 Chapter-3 (3).ppt
IP - Lecture 6, 7 Chapter-3 (3).ppt
 
Teaching presentation
Teaching presentationTeaching presentation
Teaching presentation
 
Web Design Course: CSS lecture 1
Web Design Course: CSS lecture 1Web Design Course: CSS lecture 1
Web Design Course: CSS lecture 1
 
Lecture 9 CSS part 1.pptxType Classification
Lecture 9 CSS part 1.pptxType ClassificationLecture 9 CSS part 1.pptxType Classification
Lecture 9 CSS part 1.pptxType Classification
 
Web Designing
Web DesigningWeb Designing
Web Designing
 
Cascading Style Sheets
Cascading Style SheetsCascading Style Sheets
Cascading Style Sheets
 
Vskills certified css designer Notes
Vskills certified css designer NotesVskills certified css designer Notes
Vskills certified css designer Notes
 
CSC PPT 4.pptx
CSC PPT 4.pptxCSC PPT 4.pptx
CSC PPT 4.pptx
 
MYSQL DATABASE MYSQL DATABASE MYSQL DATABASECSS.pptx
MYSQL DATABASE MYSQL DATABASE MYSQL DATABASECSS.pptxMYSQL DATABASE MYSQL DATABASE MYSQL DATABASECSS.pptx
MYSQL DATABASE MYSQL DATABASE MYSQL DATABASECSS.pptx
 
chitra
chitrachitra
chitra
 

More from Yaowaluck Promdee (17)

A basic of UX for beginner
A basic of UX for beginnerA basic of UX for beginner
A basic of UX for beginner
 
TCAS 2563
TCAS 2563TCAS 2563
TCAS 2563
 
Portfolio design
Portfolio designPortfolio design
Portfolio design
 
Concept to creation story and storyboard
Concept to creation  story and storyboard Concept to creation  story and storyboard
Concept to creation story and storyboard
 
Requirement gathering-and-lean-canvas
Requirement gathering-and-lean-canvasRequirement gathering-and-lean-canvas
Requirement gathering-and-lean-canvas
 
Good bad design
Good bad designGood bad design
Good bad design
 
Graphic, Color and tools
Graphic, Color and toolsGraphic, Color and tools
Graphic, Color and tools
 
Page layouts flexible and fixed layout with CSS
Page layouts flexible and fixed layout with CSSPage layouts flexible and fixed layout with CSS
Page layouts flexible and fixed layout with CSS
 
Powerpoint
Powerpoint Powerpoint
Powerpoint
 
Program Interface
Program Interface Program Interface
Program Interface
 
Mobile Interface
Mobile Interface   Mobile Interface
Mobile Interface
 
Personas and scenario
Personas and scenarioPersonas and scenario
Personas and scenario
 
Ux design process
Ux design processUx design process
Ux design process
 
Graphic Design
Graphic Design Graphic Design
Graphic Design
 
Lab#2 illustrator
Lab#2 illustratorLab#2 illustrator
Lab#2 illustrator
 
Good/Bad Design
Good/Bad DesignGood/Bad Design
Good/Bad Design
 
Content management system
Content management systemContent management system
Content management system
 

Recently uploaded

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaasiemaillard
 
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdf
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdfINU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdf
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdfbu07226
 
The Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonThe Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonSteve Thomason
 
Gyanartha SciBizTech Quiz slideshare.pptx
Gyanartha SciBizTech Quiz slideshare.pptxGyanartha SciBizTech Quiz slideshare.pptx
Gyanartha SciBizTech Quiz slideshare.pptxShibin Azad
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXMIRIAMSALINAS13
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxRaedMohamed3
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfVivekanand Anglo Vedic Academy
 
Forest and Wildlife Resources Class 10 Free Study Material PDF
Forest and Wildlife Resources Class 10 Free Study Material PDFForest and Wildlife Resources Class 10 Free Study Material PDF
Forest and Wildlife Resources Class 10 Free Study Material PDFVivekanand Anglo Vedic Academy
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleCeline George
 
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxbennyroshan06
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxEduSkills OECD
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfPo-Chuan Chen
 
Benefits and Challenges of Using Open Educational Resources
Benefits and Challenges of Using Open Educational ResourcesBenefits and Challenges of Using Open Educational Resources
Benefits and Challenges of Using Open Educational Resourcesdimpy50
 
Solid waste management & Types of Basic civil Engineering notes by DJ Sir.pptx
Solid waste management & Types of Basic civil Engineering notes by DJ Sir.pptxSolid waste management & Types of Basic civil Engineering notes by DJ Sir.pptx
Solid waste management & Types of Basic civil Engineering notes by DJ Sir.pptxDenish Jangid
 
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...Nguyen Thanh Tu Collection
 
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdfDanh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdfQucHHunhnh
 
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...Sayali Powar
 
slides CapTechTalks Webinar May 2024 Alexander Perry.pptx
slides CapTechTalks Webinar May 2024 Alexander Perry.pptxslides CapTechTalks Webinar May 2024 Alexander Perry.pptx
slides CapTechTalks Webinar May 2024 Alexander Perry.pptxCapitolTechU
 

Recently uploaded (20)

B.ed spl. HI pdusu exam paper-2023-24.pdf
B.ed spl. HI pdusu exam paper-2023-24.pdfB.ed spl. HI pdusu exam paper-2023-24.pdf
B.ed spl. HI pdusu exam paper-2023-24.pdf
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdf
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdfINU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdf
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdf
 
The Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonThe Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve Thomason
 
Gyanartha SciBizTech Quiz slideshare.pptx
Gyanartha SciBizTech Quiz slideshare.pptxGyanartha SciBizTech Quiz slideshare.pptx
Gyanartha SciBizTech Quiz slideshare.pptx
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
 
Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
 
Forest and Wildlife Resources Class 10 Free Study Material PDF
Forest and Wildlife Resources Class 10 Free Study Material PDFForest and Wildlife Resources Class 10 Free Study Material PDF
Forest and Wildlife Resources Class 10 Free Study Material PDF
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS Module
 
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
 
Benefits and Challenges of Using Open Educational Resources
Benefits and Challenges of Using Open Educational ResourcesBenefits and Challenges of Using Open Educational Resources
Benefits and Challenges of Using Open Educational Resources
 
Solid waste management & Types of Basic civil Engineering notes by DJ Sir.pptx
Solid waste management & Types of Basic civil Engineering notes by DJ Sir.pptxSolid waste management & Types of Basic civil Engineering notes by DJ Sir.pptx
Solid waste management & Types of Basic civil Engineering notes by DJ Sir.pptx
 
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
 
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdfDanh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
 
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...
 
slides CapTechTalks Webinar May 2024 Alexander Perry.pptx
slides CapTechTalks Webinar May 2024 Alexander Perry.pptxslides CapTechTalks Webinar May 2024 Alexander Perry.pptx
slides CapTechTalks Webinar May 2024 Alexander Perry.pptx
 

Style and Selector

  • 1. Style CSS and Selector By Yaowaluck Promdee, Sumonta Kasemvilas 322432 Web Design Technology Computer Science Khon Kaen University HOME INDEX CSS BASIC CSS SYNTAX HOW TO SELECTOR ASSIGNMENT WDS CS KKU (C) Web Design Technology 2015 1
  • 2. Index •  CSS Basic •  CSS Syntax •  How to use Style Sheet •  Selectors •  Assignment HOME INDEX CSS BASIC CSS SYNTAX HOW TO SELECTOR WDS CS KKU (C) Web Design Technology 2015 2 ASSIGNMENT
  • 3. HOME INDEX CSS BASIC CSS SYNTAX HOW TO SELECTOR WDS CS KKU What is CSS? Single Source of HTML Web Browser Other Media Print Output Server Clients Formatting data for multiple destination Cascading Style Sheets (CSS) is a style sheet language used for describing the look and formatting of a document written in a markup language. CSS Style Sheet (C) Web Design Technology 2015 3 CSS BASIC > WHAT IS CSS ASSIGNMENT
  • 4. HOME INDEX CSS BASIC CSS SYNTAX HOW TO SELECTOR WDS CS KKU http://ryanstutorials.net/css-tutorial/img/css_flexibility.png CSS is a language for describing the look and formatting of content. The selector identifies which parts of the content the rules should apply to. The rules that are inside the opening and closing curly brackets ( { } ) are applied to any items matching the selector. selector { property: value; property: value; } /* This is comments */ (C) Web Design Technology 2015 4 CSS BASIC > CSS IS A ASSIGNMENT
  • 5. HOME INDEX CSS BASIC CSS SYNTAX HOW TO SELECTOR WDS CS KKU (C) Web Design Technology 2015 5 selector { property:value } selector { property1:value1; property2:value2 } h1 { color:red; font-size:12px; } Selector Declaration Property PropertyValue Value ASSIGNMENT
  • 6. HOME INDEX CSS BASIC CSS SYNTAX HOW TO SELECTOR WDS CS KKU (C) Web Design Technology 2015 6 Three Ways to Insert CSS 1.  Inline Style 2. Internal Style Sheet 3. External Style Sheet How to inserting a style sheet ASSIGNMENT
  • 7. HOME INDEX CSS BASIC CSS SYNTAX HOW TO SELECTOR WDS CS KKU (C) Web Design Technology 2015 7 1. Inline Style HOW TO > INLINE STYLE Example <!DOCTYPE html> <html> <body> <h1 style="color:blue;margin-left:30px;">This is a heading.</h1> <p>This is a paragraph.</p> </body> </html> An inline style may be used to apply a unique style for a single element. An inline style loses many of the advantages of a style sheet (by mixing content with presentation). Use this method sparingly <Tag style="property:value;"> ASSIGNMENT
  • 8. HOME INDEX CSS BASIC CSS SYNTAX HOW TO SELECTOR WDS CS KKU (C) Web Design Technology 2015 8 2. Internal Style sheet HOW TO > INTERNAL STYLE SHEET <style type="text/css"> <!--selector {property1: value1; property2: value2}... --> </style> An internal style sheet should be used when a single document has a unique style. You define internal styles in the head section of an HTML page, inside the <style> tag body { background-color: linen; } h1 { color: maroon; margin-left: 40px; } ASSIGNMENT
  • 9. HOME INDEX CSS BASIC CSS SYNTAX HOW TO SELECTOR WDS CS KKU (C) Web Design Technology 2015 9 3. External Style sheet HOW TO > EXTERNAL STYLE SHEET <link rel="stylesheet" type="text/css" href="URL file.css"> <!DOCTYPE html><html> <head> <link rel="stylesheet" type="text/css" href="mystyle.css"> </head> <body> </body> </html> An external style sheet is ideal when the style is applied to many pages. With an external style sheet, you can change the look of an entire Web site by changing just one file. Each page must include a link to the style sheet with the <link> tag. The <link> tag goes inside the head section: ASSIGNMENT
  • 10. HOME INDEX CSS BASIC CSS SYNTAX HOW TO SELECTOR WDS CS KKU (C) Web Design Technology 2015 10 CSS Selector SELECTOR > CSS SELECTOR Element Selector ID Selector Class Selector ASSIGNMENT
  • 11. HOME INDEX CSS BASIC CSS SYNTAX HOW TO SELECTOR WDS CS KKU (C) Web Design Technology 2015 11 SELECTOR > CSS SELECTOR > ELEMENT SELECTOR The element selector selects elements based on the element name. 1. Element Selector p {     text-align: center;     color: red; } <p>Example1</p> <h1>Example2</h1> <p>Example3</p> Result --------------------------------------- Example1 Example2 Example3 ASSIGNMENT
  • 12. HOME INDEX CSS BASIC CSS SYNTAX HOW TO SELECTOR WDS CS KKU (C) Web Design Technology 2015 12 SELECTOR > CSS SELECTOR > ID SELECTOR 2. ID Selector The id selector uses the id attribute of an HTML tag to find the specific element. An id should be unique within a page, so you should use the id selector when you want to find a single, unique element. #paragraph {     text-align: center;     color: red; } <p id="paragraph">Hello World!</p> <p>This paragraph is not affected by the style.</p> ASSIGNMENT
  • 13. HOME INDEX CSS BASIC CSS SYNTAX HOW TO SELECTOR WDS CS KKU (C) Web Design Technology 2015 13 SELECTOR > CSS SELECTOR > CLASS SELECTOR 3. Class Selector .center { text-align: center; color: red; } <h1 class="center">sentence1</h1> <p class="center">sentence2</p> The class selector finds elements with the specific class. The class selector uses the HTML class attribute. To find elements with a specific class, write a period character, followed by the name of the class: ASSIGNMENT
  • 14. HOME INDEX CSS BASIC CSS SYNTAX HOW TO SELECTOR WDS CS KKU (C) Web Design Technology 2015 14 ASSIGNMENT Example 2 SELECTOR > CSS SELECTOR > CLASS SELECTOR > EXAMPLE <h1>This is a heading</h1> <h2>This is a smaller heading</h2> <p>This is a paragraph.</p> <p>This is another paragraph.</p> How to write CSS? Answer: Try it! Change the color of all <p> and <h1> elements, to “blue”, and h1 is bold font. Group the selectors to minimize code.
  • 15. HOME INDEX CSS BASIC CSS SYNTAX HOW TO SELECTOR WDS CS KKU (C) Web Design Technology 2015 15 ASSIGNMENT Example Selector Class attribute SELECTOR > CSS SELECTOR > CLASS SELECTOR > EXAMPLE p.center { text-align: center; color: red; font-weight:bold; } <h1 class="center">This heading </h1> <p class="center">This paragraph will be red and center-aligned.</p> Try it!
  • 16. HOME INDEX CSS BASIC CSS SYNTAX HOW TO SELECTOR ASSIGNMENT WDS CS KKU (C) Web Design Technology 2015 16 Assignment#5 Style and Selectors Create a Webpage to present your two favorite movies using CSS (eg. all selectors in class today: element, class, id sector) and you must comment your own CSS code. Grade will be based on your CSS technique and look and feel of the Web page.