SlideShare a Scribd company logo
(Cascaded Style Sheet Selectors)
Tutorial On
Insert Your Image Here!!
By:
(Dinesh Kumar)
PGT(Computer Science, DPS Bareilly)
A CSS selector is the part of a CSS rule set that actually selects the
content you want to style.
Universal Selector
Element Type Selector
ID Selector
Class Selector
Descendant Combinator
Child Combinator
Adjacent Sibling Combinator
Attribute Selector
Pseudo-class
CSS selector Types
The universal selector represented by symbol (*)
works like a wild card character, selecting all elements
on a page.
The three lines of code inside the curly braces
(color, font-size, and line-height) will apply to all
elements on the HTML page
Universal Selector
*{
color: green;
font-size: 20px;
line-height: 25px;
}
Also referred to as a “type selector,” this selector must
match one or more HTML elements of the same
name.
The following example uses an element type selector
to match all <ul> elements:
Element Type Selector
ul
{
list-style: none;
border: solid 1px #ccc;
}
An ID selector is declared using a hash, or pound symbol (#).
This selector matches any HTML element that has an ID
attribute with the same value as that of the selector, but
minus the hash symbol.
This CSS uses an ID selector to match an HTML element such
as:
ID Selector
#container
{
width: 960px;
margin: 0 auto;
}
<div id="container">………</div>
The class selector is the most useful of all CSS selectors.
The class selector matches all elements on the page that have
their class attribute set to the same value as the class
selector.
These styles will apply to the following HTML element:
<div class="box"></div>
Class Selector
.box
{
padding: 20px;
margin: 10px;
width: 240px;
}
The descendant combinator lets you combine two or more
selectors so you can be more specific in your selection
method.
This declaration block will apply to all elements that have a
class of box that are inside an element with an ID
of container.
Example:
<div id="container">
<div class="box">…..</div>
</div>
Descendant Combinator
#container .box
{
float: left;
padding-bottom: 15px;
}
A selector that uses the child combinator is similar to a
selector that uses a descendant combinator, except it
only targets immediate child elements.
This is the same code from the descendant combinator,
but instead of a space character, we’re using the
greater-than symbol.
Child Combinator
#container > .box
{
float: left;
padding-bottom: 15px;
}
A selector that uses the adjacent sibling combinator uses
the (+) symbol, and is almost the same as the general
sibling selector. The difference is that the targeted
element must be an immediate sibling, not just a
general sibling.
Adjacent Sibling Combinator
p + p
{
text-indent: 1.5em;
margin-bottom: 0;
}
The attribute selector targets elements based on the
presence of HTML attributes, and is declared using
square brackets:
The above CSS would match the following element:
<input type="text">
Attribute Selector
input[type="text"]
{
background-color: #444;
width: 200px;
}
The attribute selector can also be declared using just the
attribute itself, with no value, like this:
This will match all input elements with an attribute
of type, regardless of the value.
Attribute Selector…
input[type]
{
background-color: #444;
width: 200px;
}
A pseudo-class uses a colon character to identify a
pseudo-state that an element might be in—for
example, the state of being hovered, or the state of
being activated.
This means that when the user hovers their mouse over
an element, the color property for that element will change
to red.
Pseudo-class
a:hover
{
color: red;
}
Some of the most frequently used pseudo-classes are as
follows:
:first-child pseudo-class
The :first-child pseudo-class matches an element that is the
first child element of some other element.
Pseudo-class…
div > p:first-child
{
text-indent: 0
}
The link pseudo-classes: :link and :visited
• The :link pseudo-class applies for links that have not
yet been visited.
• The :visited pseudo-class applies once the link has
been visited by the user.
Pseudo-class…
a:link { color: blue }
a:visited { color: purple }
The dynamic pseudo-classes: :hover, :active,
and :focus
• The :hover pseudo-class applies while the user
designates an element (with some pointing device),
but does not activate it.
• The :active pseudo-class applies while an element is
being activated by the user.
• The :focus pseudo-class applies while an element has
the focus (accepts keyboard events or other forms of
text input).
Pseudo-class…
Pseudo-class…
The last selector matches A elements that are in pseudo-
class :focus and in pseudo-class :hover.
a:link { color: red } /* unvisited links */
a:visited { color: blue } /* visited links */
a:hover { color: yellow } /* user hovers */
a:active { color: lime } /* active links */
a:focus { background: yellow }
a:focus:hover { background: white }
Css selectors

More Related Content

What's hot

Id and class selector
Id and class selectorId and class selector
Id and class selector
MyCredentials YourReference
 
Cascading Style Sheet (CSS)
Cascading Style Sheet (CSS)Cascading Style Sheet (CSS)
Cascading Style Sheet (CSS)
AakankshaR
 
Css Ppt
Css PptCss Ppt
Css Ppt
Hema Prasanth
 
Types of Selectors (HTML)
Types of Selectors (HTML)Types of Selectors (HTML)
Types of Selectors (HTML)
Deanne Alcalde
 
Css selectors
Css selectorsCss selectors
Css selectors
Parth Trivedi
 
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 lecture notes
Css lecture notesCss lecture notes
Css lecture notes
Santhiya Grace
 
DTD
DTDDTD
Introduction to CSS Borders - Lesson 4
Introduction to CSS Borders - Lesson 4Introduction to CSS Borders - Lesson 4
Introduction to CSS Borders - Lesson 4
Naresh Sharma
 
Css properties
Css propertiesCss properties
Css properties
suresh_jathari
 
Html multimedia tag
Html multimedia tagHtml multimedia tag
Html multimedia tag
Student
 
An Overview of HTML, CSS & Java Script
An Overview of HTML, CSS & Java ScriptAn Overview of HTML, CSS & Java Script
An Overview of HTML, CSS & Java Script
Fahim Abdullah
 
Css properties
Css propertiesCss properties
Datatype in JavaScript
Datatype in JavaScriptDatatype in JavaScript
Datatype in JavaScript
Rajat Saxena
 
Cascading Style Sheet
Cascading Style SheetCascading Style Sheet
Cascading Style Sheet
vijayta
 
HTML5: features with examples
HTML5: features with examplesHTML5: features with examples
HTML5: features with examples
Alfredo Torre
 
What is CSS?
What is CSS?What is CSS?
What is CSS?
HalaiHansaika
 
Cascading Style Sheets - Part 01
Cascading Style Sheets - Part 01Cascading Style Sheets - Part 01
Cascading Style Sheets - Part 01
Hatem Mahmoud
 
Html Form Controls
Html Form ControlsHtml Form Controls

What's hot (20)

Id and class selector
Id and class selectorId and class selector
Id and class selector
 
Cascading Style Sheet (CSS)
Cascading Style Sheet (CSS)Cascading Style Sheet (CSS)
Cascading Style Sheet (CSS)
 
Css Ppt
Css PptCss Ppt
Css Ppt
 
Css
CssCss
Css
 
Types of Selectors (HTML)
Types of Selectors (HTML)Types of Selectors (HTML)
Types of Selectors (HTML)
 
Css selectors
Css selectorsCss selectors
Css selectors
 
Introduction to Cascading Style Sheets (CSS)
Introduction to Cascading Style Sheets (CSS)Introduction to Cascading Style Sheets (CSS)
Introduction to Cascading Style Sheets (CSS)
 
Css lecture notes
Css lecture notesCss lecture notes
Css lecture notes
 
DTD
DTDDTD
DTD
 
Introduction to CSS Borders - Lesson 4
Introduction to CSS Borders - Lesson 4Introduction to CSS Borders - Lesson 4
Introduction to CSS Borders - Lesson 4
 
Css properties
Css propertiesCss properties
Css properties
 
Html multimedia tag
Html multimedia tagHtml multimedia tag
Html multimedia tag
 
An Overview of HTML, CSS & Java Script
An Overview of HTML, CSS & Java ScriptAn Overview of HTML, CSS & Java Script
An Overview of HTML, CSS & Java Script
 
Css properties
Css propertiesCss properties
Css properties
 
Datatype in JavaScript
Datatype in JavaScriptDatatype in JavaScript
Datatype in JavaScript
 
Cascading Style Sheet
Cascading Style SheetCascading Style Sheet
Cascading Style Sheet
 
HTML5: features with examples
HTML5: features with examplesHTML5: features with examples
HTML5: features with examples
 
What is CSS?
What is CSS?What is CSS?
What is CSS?
 
Cascading Style Sheets - Part 01
Cascading Style Sheets - Part 01Cascading Style Sheets - Part 01
Cascading Style Sheets - Part 01
 
Html Form Controls
Html Form ControlsHtml Form Controls
Html Form Controls
 

Similar to Css selectors

Introducing CSS Selectors.docx
Introducing CSS Selectors.docxIntroducing CSS Selectors.docx
Introducing CSS Selectors.docx
Dr. Somnath Sinha
 
Css class-02
Css class-02Css class-02
Css class-02
Md Ali Hossain
 
Lesson 3 - HTML & CSS Part 2
Lesson 3 - HTML & CSS Part 2Lesson 3 - HTML & CSS Part 2
Lesson 3 - HTML & CSS Part 2
hstryk
 
Web 2 | CSS - Cascading Style Sheets
Web 2 | CSS - Cascading Style SheetsWeb 2 | CSS - Cascading Style Sheets
Web 2 | CSS - Cascading Style Sheets
Mohammad Imam Hossain
 
3-CSS_essentials.ppt
3-CSS_essentials.ppt3-CSS_essentials.ppt
3-CSS_essentials.ppt
datapro2
 
3-CSS_essentials introduction slides.ppt
3-CSS_essentials introduction slides.ppt3-CSS_essentials introduction slides.ppt
3-CSS_essentials introduction slides.ppt
Aasma13
 
3-CSS_essentials_developers_begineers.ppt
3-CSS_essentials_developers_begineers.ppt3-CSS_essentials_developers_begineers.ppt
3-CSS_essentials_developers_begineers.ppt
mohamed abd elrazek
 
3-CSS_essentials.ppt
3-CSS_essentials.ppt3-CSS_essentials.ppt
3-CSS_essentials.ppt
scet315
 
Lecture2 CSS 2
Lecture2  CSS 2Lecture2  CSS 2
CSS Foundations, pt 2
CSS Foundations, pt 2CSS Foundations, pt 2
CSS Foundations, pt 2
Shawn Calvert
 
3 css essentials
3 css essentials3 css essentials
3 css essentials
Anchu S
 
Designing for the web - 101
Designing for the web - 101Designing for the web - 101
Designing for the web - 101
Ashraf Hamdy
 
Web Programming& Scripting Lab
Web Programming& Scripting LabWeb Programming& Scripting Lab
Web Programming& Scripting Lab
Swapnali Pawar
 
Basic css
Basic cssBasic css
Basic css
Gopinath Ambothi
 
Cascading Style Sheets
Cascading Style SheetsCascading Style Sheets
Cascading Style Sheets
M Vishnuvardhan Reddy
 
How Cascading Style Sheets (CSS) Works
How Cascading Style Sheets (CSS) WorksHow Cascading Style Sheets (CSS) Works
How Cascading Style Sheets (CSS) Works
Amit Tyagi
 
CSS
CSSCSS
Introduction to Html5, css, Javascript and Jquery
Introduction to Html5, css, Javascript and JqueryIntroduction to Html5, css, Javascript and Jquery
Introduction to Html5, css, Javascript and Jquery
valuebound
 
Css Selectors
Css SelectorsCss Selectors
Css Selectors
Igor Ognichenko
 
Css3
Css3Css3

Similar to Css selectors (20)

Introducing CSS Selectors.docx
Introducing CSS Selectors.docxIntroducing CSS Selectors.docx
Introducing CSS Selectors.docx
 
Css class-02
Css class-02Css class-02
Css class-02
 
Lesson 3 - HTML & CSS Part 2
Lesson 3 - HTML & CSS Part 2Lesson 3 - HTML & CSS Part 2
Lesson 3 - HTML & CSS Part 2
 
Web 2 | CSS - Cascading Style Sheets
Web 2 | CSS - Cascading Style SheetsWeb 2 | CSS - Cascading Style Sheets
Web 2 | CSS - Cascading Style Sheets
 
3-CSS_essentials.ppt
3-CSS_essentials.ppt3-CSS_essentials.ppt
3-CSS_essentials.ppt
 
3-CSS_essentials introduction slides.ppt
3-CSS_essentials introduction slides.ppt3-CSS_essentials introduction slides.ppt
3-CSS_essentials introduction slides.ppt
 
3-CSS_essentials_developers_begineers.ppt
3-CSS_essentials_developers_begineers.ppt3-CSS_essentials_developers_begineers.ppt
3-CSS_essentials_developers_begineers.ppt
 
3-CSS_essentials.ppt
3-CSS_essentials.ppt3-CSS_essentials.ppt
3-CSS_essentials.ppt
 
Lecture2 CSS 2
Lecture2  CSS 2Lecture2  CSS 2
Lecture2 CSS 2
 
CSS Foundations, pt 2
CSS Foundations, pt 2CSS Foundations, pt 2
CSS Foundations, pt 2
 
3 css essentials
3 css essentials3 css essentials
3 css essentials
 
Designing for the web - 101
Designing for the web - 101Designing for the web - 101
Designing for the web - 101
 
Web Programming& Scripting Lab
Web Programming& Scripting LabWeb Programming& Scripting Lab
Web Programming& Scripting Lab
 
Basic css
Basic cssBasic css
Basic css
 
Cascading Style Sheets
Cascading Style SheetsCascading Style Sheets
Cascading Style Sheets
 
How Cascading Style Sheets (CSS) Works
How Cascading Style Sheets (CSS) WorksHow Cascading Style Sheets (CSS) Works
How Cascading Style Sheets (CSS) Works
 
CSS
CSSCSS
CSS
 
Introduction to Html5, css, Javascript and Jquery
Introduction to Html5, css, Javascript and JqueryIntroduction to Html5, css, Javascript and Jquery
Introduction to Html5, css, Javascript and Jquery
 
Css Selectors
Css SelectorsCss Selectors
Css Selectors
 
Css3
Css3Css3
Css3
 

Recently uploaded

คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
สมใจ จันสุกสี
 
How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience
Wahiba Chair Training & Consulting
 
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptxBeyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
EduSkills OECD
 
math operations ued in python and all used
math operations ued in python and all usedmath operations ued in python and all used
math operations ued in python and all used
ssuser13ffe4
 
Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47
MysoreMuleSoftMeetup
 
Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
Dr. Mulla Adam Ali
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
Celine George
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
siemaillard
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
Katrina Pritchard
 
ZK on Polkadot zero knowledge proofs - sub0.pptx
ZK on Polkadot zero knowledge proofs - sub0.pptxZK on Polkadot zero knowledge proofs - sub0.pptx
ZK on Polkadot zero knowledge proofs - sub0.pptx
dot55audits
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
mulvey2
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
Nguyen Thanh Tu Collection
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
eBook.com.bd (প্রয়োজনীয় বাংলা বই)
 
Constructing Your Course Container for Effective Communication
Constructing Your Course Container for Effective CommunicationConstructing Your Course Container for Effective Communication
Constructing Your Course Container for Effective Communication
Chevonnese Chevers Whyte, MBA, B.Sc.
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
Colégio Santa Teresinha
 
UGC NET Exam Paper 1- Unit 1:Teaching Aptitude
UGC NET Exam Paper 1- Unit 1:Teaching AptitudeUGC NET Exam Paper 1- Unit 1:Teaching Aptitude
UGC NET Exam Paper 1- Unit 1:Teaching Aptitude
S. Raj Kumar
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
WaniBasim
 
Solutons Maths Escape Room Spatial .pptx
Solutons Maths Escape Room Spatial .pptxSolutons Maths Escape Room Spatial .pptx
Solutons Maths Escape Room Spatial .pptx
spdendr
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
Priyankaranawat4
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
heathfieldcps1
 

Recently uploaded (20)

คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
 
How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience
 
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptxBeyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
 
math operations ued in python and all used
math operations ued in python and all usedmath operations ued in python and all used
math operations ued in python and all used
 
Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47
 
Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
 
ZK on Polkadot zero knowledge proofs - sub0.pptx
ZK on Polkadot zero knowledge proofs - sub0.pptxZK on Polkadot zero knowledge proofs - sub0.pptx
ZK on Polkadot zero knowledge proofs - sub0.pptx
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
 
Constructing Your Course Container for Effective Communication
Constructing Your Course Container for Effective CommunicationConstructing Your Course Container for Effective Communication
Constructing Your Course Container for Effective Communication
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
 
UGC NET Exam Paper 1- Unit 1:Teaching Aptitude
UGC NET Exam Paper 1- Unit 1:Teaching AptitudeUGC NET Exam Paper 1- Unit 1:Teaching Aptitude
UGC NET Exam Paper 1- Unit 1:Teaching Aptitude
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
 
Solutons Maths Escape Room Spatial .pptx
Solutons Maths Escape Room Spatial .pptxSolutons Maths Escape Room Spatial .pptx
Solutons Maths Escape Room Spatial .pptx
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
 

Css selectors

  • 1. (Cascaded Style Sheet Selectors) Tutorial On Insert Your Image Here!! By: (Dinesh Kumar) PGT(Computer Science, DPS Bareilly)
  • 2. A CSS selector is the part of a CSS rule set that actually selects the content you want to style. Universal Selector Element Type Selector ID Selector Class Selector Descendant Combinator Child Combinator Adjacent Sibling Combinator Attribute Selector Pseudo-class CSS selector Types
  • 3. The universal selector represented by symbol (*) works like a wild card character, selecting all elements on a page. The three lines of code inside the curly braces (color, font-size, and line-height) will apply to all elements on the HTML page Universal Selector *{ color: green; font-size: 20px; line-height: 25px; }
  • 4. Also referred to as a “type selector,” this selector must match one or more HTML elements of the same name. The following example uses an element type selector to match all <ul> elements: Element Type Selector ul { list-style: none; border: solid 1px #ccc; }
  • 5. An ID selector is declared using a hash, or pound symbol (#). This selector matches any HTML element that has an ID attribute with the same value as that of the selector, but minus the hash symbol. This CSS uses an ID selector to match an HTML element such as: ID Selector #container { width: 960px; margin: 0 auto; } <div id="container">………</div>
  • 6. The class selector is the most useful of all CSS selectors. The class selector matches all elements on the page that have their class attribute set to the same value as the class selector. These styles will apply to the following HTML element: <div class="box"></div> Class Selector .box { padding: 20px; margin: 10px; width: 240px; }
  • 7. The descendant combinator lets you combine two or more selectors so you can be more specific in your selection method. This declaration block will apply to all elements that have a class of box that are inside an element with an ID of container. Example: <div id="container"> <div class="box">…..</div> </div> Descendant Combinator #container .box { float: left; padding-bottom: 15px; }
  • 8. A selector that uses the child combinator is similar to a selector that uses a descendant combinator, except it only targets immediate child elements. This is the same code from the descendant combinator, but instead of a space character, we’re using the greater-than symbol. Child Combinator #container > .box { float: left; padding-bottom: 15px; }
  • 9. A selector that uses the adjacent sibling combinator uses the (+) symbol, and is almost the same as the general sibling selector. The difference is that the targeted element must be an immediate sibling, not just a general sibling. Adjacent Sibling Combinator p + p { text-indent: 1.5em; margin-bottom: 0; }
  • 10. The attribute selector targets elements based on the presence of HTML attributes, and is declared using square brackets: The above CSS would match the following element: <input type="text"> Attribute Selector input[type="text"] { background-color: #444; width: 200px; }
  • 11. The attribute selector can also be declared using just the attribute itself, with no value, like this: This will match all input elements with an attribute of type, regardless of the value. Attribute Selector… input[type] { background-color: #444; width: 200px; }
  • 12. A pseudo-class uses a colon character to identify a pseudo-state that an element might be in—for example, the state of being hovered, or the state of being activated. This means that when the user hovers their mouse over an element, the color property for that element will change to red. Pseudo-class a:hover { color: red; }
  • 13. Some of the most frequently used pseudo-classes are as follows: :first-child pseudo-class The :first-child pseudo-class matches an element that is the first child element of some other element. Pseudo-class… div > p:first-child { text-indent: 0 }
  • 14. The link pseudo-classes: :link and :visited • The :link pseudo-class applies for links that have not yet been visited. • The :visited pseudo-class applies once the link has been visited by the user. Pseudo-class… a:link { color: blue } a:visited { color: purple }
  • 15. The dynamic pseudo-classes: :hover, :active, and :focus • The :hover pseudo-class applies while the user designates an element (with some pointing device), but does not activate it. • The :active pseudo-class applies while an element is being activated by the user. • The :focus pseudo-class applies while an element has the focus (accepts keyboard events or other forms of text input). Pseudo-class…
  • 16. Pseudo-class… The last selector matches A elements that are in pseudo- class :focus and in pseudo-class :hover. a:link { color: red } /* unvisited links */ a:visited { color: blue } /* visited links */ a:hover { color: yellow } /* user hovers */ a:active { color: lime } /* active links */ a:focus { background: yellow } a:focus:hover { background: white }