SlideShare uma empresa Scribd logo
1 de 13
Baixar para ler offline
Lab#5 Style and Selector 322432 Web Design Technology By Yaowaluck Promdee, Sumonta Kasemvilas
CSS Basic 
Single Source of HTML 
CSS Style Sheet 
Web Browser 
Other Media 
Print Output 
Formatting data for multiple destination 
Server 
Clients
CSS Syntax 
selector { property:value } 
selector { property1:value1; property2:value2 }
How to use Style Sheet 
1. Inline Styles 
<Tag style="property:value;"> 
<p style="color:black; font-family:Arial; font-weight:bold”>Hello World!!</p> 
An inline style loses many of the advantages of a style sheet. Use this method sparingly! 
To use inline styles, add the style attribute to the relevant tag. The style attribute can contain any CSS property.
2. 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
3. External Style Sheet 
<link rel="stylesheet" type="text/css" href="URL file.css"> 
<html> 
<head> 
<link rel="stylesheet" type="text/css" href="mystyle.css"> 
</head> 
<body> 
Example 
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:
CSS Selector 
- The element Selector 
- The id Selector 
- The class Selector
1. Element Selector 
p { text-align: center; color: red; } 
<p>Example1</p> 
<p id="paragraph">Example2</p> 
<p>Example3</p> 
The element selector selects elements based on the element name.
2. Id Selector 
#paragraph { text-align: center; color: red; } 
<p id="paragraph">Hello World!</p> 
<p>This paragraph is not affected by the style.</p> 
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.
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:
Example Selector Class attribute 
.topic {color:red; 
font-family:Arial; 
font-weight:bold; 
text-align:center; } 
<div class="topic”>Heading</div> 
<p class="topic”>Topic Name</p> 
p.topic{color:red; font-family:Arial; font-weight:bold; text-align:center }
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.
Example

Mais conteúdo relacionado

Mais procurados

Mais procurados (20)

Design sitemap
Design sitemapDesign sitemap
Design sitemap
 
Navigation and Link
Navigation and LinkNavigation and Link
Navigation and Link
 
CSS Dasar #2 : Anatomy CSS
CSS Dasar #2 : Anatomy CSSCSS Dasar #2 : Anatomy CSS
CSS Dasar #2 : Anatomy CSS
 
CSS3 Media Queries
CSS3 Media QueriesCSS3 Media Queries
CSS3 Media Queries
 
CSS Dasar #4 : Font Styling
CSS Dasar #4 : Font StylingCSS Dasar #4 : Font Styling
CSS Dasar #4 : Font Styling
 
CSS3, Media Queries, and Responsive Design
CSS3, Media Queries, and Responsive DesignCSS3, Media Queries, and Responsive Design
CSS3, Media Queries, and Responsive Design
 
Complete Lecture on Css presentation
Complete Lecture on Css presentation Complete Lecture on Css presentation
Complete Lecture on Css presentation
 
Sitemap Templates by Creately
Sitemap Templates by CreatelySitemap Templates by Creately
Sitemap Templates by Creately
 
CSS Grid Changes Everything About Web Layouts: WordCamp Europe 2017
CSS Grid Changes Everything About Web Layouts: WordCamp Europe 2017CSS Grid Changes Everything About Web Layouts: WordCamp Europe 2017
CSS Grid Changes Everything About Web Layouts: WordCamp Europe 2017
 
CSS Best practice
CSS Best practiceCSS Best practice
CSS Best practice
 
Introducing CSS Grid
Introducing CSS GridIntroducing CSS Grid
Introducing CSS Grid
 
Media queries A to Z
Media queries A to ZMedia queries A to Z
Media queries A to Z
 
Tailwind CSS.11.pptx
Tailwind CSS.11.pptxTailwind CSS.11.pptx
Tailwind CSS.11.pptx
 
Bootstrap Framework
Bootstrap Framework Bootstrap Framework
Bootstrap Framework
 
Css ppt
Css pptCss ppt
Css ppt
 
Tech talk on Tailwind CSS
Tech talk on Tailwind CSSTech talk on Tailwind CSS
Tech talk on Tailwind CSS
 
Introduction to HTML and CSS
Introduction to HTML and CSSIntroduction to HTML and CSS
Introduction to HTML and CSS
 
Flex box
Flex boxFlex box
Flex box
 
CSS Dasar #5 : Text Styling
CSS Dasar #5 : Text StylingCSS Dasar #5 : Text Styling
CSS Dasar #5 : Text Styling
 
CSS Dasar #3 : Penempatan CSS
CSS Dasar #3 : Penempatan CSSCSS Dasar #3 : Penempatan CSS
CSS Dasar #3 : Penempatan CSS
 

Semelhante a Lab#5 style and selector

Cascading Styling Sheets(CSS) simple design language intended to transform th...
Cascading Styling Sheets(CSS) simple design language intended to transform th...Cascading Styling Sheets(CSS) simple design language intended to transform th...
Cascading Styling Sheets(CSS) simple design language intended to transform th...
JebaRaj26
 
Ifi7174 lesson2
Ifi7174 lesson2Ifi7174 lesson2
Ifi7174 lesson2
Sónia
 
Chapter 4a cascade style sheet css
Chapter 4a cascade style sheet cssChapter 4a cascade style sheet css
Chapter 4a cascade style sheet css
Tesfaye Yenealem
 

Semelhante a Lab#5 style and selector (20)

Basic Details of HTML and CSS.pdf
Basic Details of HTML and CSS.pdfBasic Details of HTML and CSS.pdf
Basic Details of HTML and CSS.pdf
 
CSS.pdf
CSS.pdfCSS.pdf
CSS.pdf
 
CSS
CSSCSS
CSS
 
CSS(Cascading Stylesheet)
CSS(Cascading Stylesheet)CSS(Cascading Stylesheet)
CSS(Cascading Stylesheet)
 
Cascading Styling Sheets(CSS) simple design language intended to transform th...
Cascading Styling Sheets(CSS) simple design language intended to transform th...Cascading Styling Sheets(CSS) simple design language intended to transform th...
Cascading Styling Sheets(CSS) simple design language intended to transform th...
 
Web technology Unit-II Part-C
Web technology Unit-II Part-CWeb technology Unit-II Part-C
Web technology Unit-II Part-C
 
Ifi7174 lesson2
Ifi7174 lesson2Ifi7174 lesson2
Ifi7174 lesson2
 
An Introduction to Cascading Style Sheets (CSS3)
An Introduction to Cascading Style Sheets (CSS3)An Introduction to Cascading Style Sheets (CSS3)
An Introduction to Cascading Style Sheets (CSS3)
 
chitra
chitrachitra
chitra
 
Web Design Course: CSS lecture 1
Web Design Course: CSS lecture 1Web Design Course: CSS lecture 1
Web Design Course: CSS lecture 1
 
Cascading style sheet an introduction
Cascading style sheet   an introductionCascading style sheet   an introduction
Cascading style sheet an introduction
 
Lec 1
Lec 1Lec 1
Lec 1
 
Css.html
Css.htmlCss.html
Css.html
 
Chapter 4a cascade style sheet css
Chapter 4a cascade style sheet cssChapter 4a cascade style sheet css
Chapter 4a cascade style sheet css
 
Angular JS
Angular JSAngular JS
Angular JS
 
Website design 2
Website design 2Website design 2
Website design 2
 
Cmsc 100 xhtml and css
Cmsc 100 xhtml and cssCmsc 100 xhtml and css
Cmsc 100 xhtml and css
 
1. Advanced Web Designing (12th IT) (1).pdf
1. Advanced Web Designing (12th IT) (1).pdf1. Advanced Web Designing (12th IT) (1).pdf
1. Advanced Web Designing (12th IT) (1).pdf
 
CLIENT SIDE PROGRAMMING
CLIENT SIDE PROGRAMMINGCLIENT SIDE PROGRAMMING
CLIENT SIDE PROGRAMMING
 
Chapter 02
Chapter 02Chapter 02
Chapter 02
 

Mais de Yaowaluck Promdee

Mais de Yaowaluck Promdee (20)

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
 
Observation and interviewing
Observation and interviewingObservation and interviewing
Observation and interviewing
 
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
 
Style and Selector Part2
Style and Selector Part2Style and Selector Part2
Style and Selector Part2
 
HTML 5
HTML 5HTML 5
HTML 5
 
Overview HTML, HTML5 and Validations
Overview HTML, HTML5 and Validations Overview HTML, HTML5 and Validations
Overview HTML, HTML5 and Validations
 
Web Interface
Web InterfaceWeb Interface
Web Interface
 
Game design
Game designGame design
Game design
 
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
 

Último

The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 

Último (20)

The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptx
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 

Lab#5 style and selector

  • 1. Lab#5 Style and Selector 322432 Web Design Technology By Yaowaluck Promdee, Sumonta Kasemvilas
  • 2. CSS Basic Single Source of HTML CSS Style Sheet Web Browser Other Media Print Output Formatting data for multiple destination Server Clients
  • 3. CSS Syntax selector { property:value } selector { property1:value1; property2:value2 }
  • 4. How to use Style Sheet 1. Inline Styles <Tag style="property:value;"> <p style="color:black; font-family:Arial; font-weight:bold”>Hello World!!</p> An inline style loses many of the advantages of a style sheet. Use this method sparingly! To use inline styles, add the style attribute to the relevant tag. The style attribute can contain any CSS property.
  • 5. 2. 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
  • 6. 3. External Style Sheet <link rel="stylesheet" type="text/css" href="URL file.css"> <html> <head> <link rel="stylesheet" type="text/css" href="mystyle.css"> </head> <body> Example 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:
  • 7. CSS Selector - The element Selector - The id Selector - The class Selector
  • 8. 1. Element Selector p { text-align: center; color: red; } <p>Example1</p> <p id="paragraph">Example2</p> <p>Example3</p> The element selector selects elements based on the element name.
  • 9. 2. Id Selector #paragraph { text-align: center; color: red; } <p id="paragraph">Hello World!</p> <p>This paragraph is not affected by the style.</p> 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.
  • 10. 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:
  • 11. Example Selector Class attribute .topic {color:red; font-family:Arial; font-weight:bold; text-align:center; } <div class="topic”>Heading</div> <p class="topic”>Topic Name</p> p.topic{color:red; font-family:Arial; font-weight:bold; text-align:center }
  • 12. 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.