SlideShare une entreprise Scribd logo
1  sur  14
Media Queries
Presented by,
Midhun . L. Madhu
What are Media Queries?
• Allows us to change our layouts to suit the exact need of different devices
without changing the content.
• It is applied with the help of CSS3.
• Media queries are CSS extensions to media types that give us more control
over rendering across different devices.
• Media query is a logical expression which is either true or false.
• CSS associated with media query is only applied if the expression is true.
What are Media Types?
• CSS can be used to specify how a document is presented in different media
• There are ten media types defined in CSS
–

all : suitable for all devices.

–

handheld : for handheld devices.

–

screen : for color computer screens.

–

tv : for television type devices.

–

aural : for speech synthesizer.

–

braille : for braille tactile feed back devices.

–

embossed : for paged braille printers.

–

projection : for projected presentations .

–

tty : for teletypes and terminals.

–

print : for print material.
Methods to specify Media for CSS
• First method:
– You can use a <link> element in the head of your HTML document to
specify the target media of an external style sheet.
Example:
<link rel=“stylesheet” href=“a.css” type=“type/css” media=“screen”/>

• Second method:
– You can use a <?xml-stylesheetl?> element in the head of your XML
document to specify the target media of an external style sheet.
Example:
<?xml-stylesheet media=“screen” rel=“stylesheet” href=“example.css”?>
Methods to specify Media for CSS
• Third method:
– You can specify the target medium within a CSS file using @media
Example:
@media screen
{
body{color:blue;}
}
Media Query Syntax
<style>
@media screen and (color)
{
body{color:blue;}
}
</style>
Media type

keyword

Media feature
Media Feature List
Types Of Keywords
• and:
– You can use multiple expressions in a media query if you join them
with “and “ keyword.
E.g.:
<style>
@media screen and (minwidth:200px) and (max-width:600px)
{
body{color:blue;}
}
</style>
Types Of Keywords
• Comma Separated:
– You can use multiple, comma-separated media queries.
– This comma act like an “or” keyword.
E.g.:
<style>
@media screen and (minwidth:200px) or (max-width:600px)
{
body{color:blue;}
}
</style>
Types Of Keywords
• not:
– You can use the not keyword in a media query if you want your CSS to
be ignored by a specific device.
E.g.:
<style>
@media not screen and (minwidth:200px)
{
body{color:blue;}
}
</style>
Types Of Keywords
• only:
– You can use the only keyword in a media query if you want your CSS to
be applied only to a specific device.
E.g.:
<style>
@media only screen and (minwidth:200px)
{
body{color:blue;}
}
</style>
Targeting iPhone
• iPhone does not support hand held media type.
• Apple recommends targeting the iPhone using media queries.
E.g.:
<style type=“text/css”>
@media screen and (max-width:480px)
{
body{color:magenta;}
}
</style>
Browser Support for Media Queries
QUERIES??

Contenu connexe

Tendances

Tendances (20)

Css ppt
Css pptCss ppt
Css ppt
 
Introduction to Bootstrap
Introduction to BootstrapIntroduction to Bootstrap
Introduction to Bootstrap
 
Introduction to SASS
Introduction to SASSIntroduction to SASS
Introduction to SASS
 
Presentation of bootstrap
Presentation of bootstrapPresentation of bootstrap
Presentation of bootstrap
 
Bootstrap Part - 1
Bootstrap Part - 1Bootstrap Part - 1
Bootstrap Part - 1
 
Bootstrap 5 basic
Bootstrap 5 basicBootstrap 5 basic
Bootstrap 5 basic
 
CSS Font & Text style
CSS Font & Text style CSS Font & Text style
CSS Font & Text style
 
Bootstrap
BootstrapBootstrap
Bootstrap
 
Introduction to HTML and CSS
Introduction to HTML and CSSIntroduction to HTML and CSS
Introduction to HTML and CSS
 
Css3
Css3Css3
Css3
 
Css box-model
Css box-modelCss box-model
Css box-model
 
Introduction to HTML and CSS
Introduction to HTML and CSSIntroduction to HTML and CSS
Introduction to HTML and CSS
 
Beginners css tutorial for web designers
Beginners css tutorial for web designersBeginners css tutorial for web designers
Beginners css tutorial for web designers
 
CSS Day: CSS Grid Layout
CSS Day: CSS Grid Layout CSS Day: CSS Grid Layout
CSS Day: CSS Grid Layout
 
HTML and CSS crash course!
HTML and CSS crash course!HTML and CSS crash course!
HTML and CSS crash course!
 
CSS Flexbox (flexible box layout)
CSS Flexbox (flexible box layout)CSS Flexbox (flexible box layout)
CSS Flexbox (flexible box layout)
 
Flexbox and Grid Layout
Flexbox and Grid LayoutFlexbox and Grid Layout
Flexbox and Grid Layout
 
Bootstrap PPT by Mukesh
Bootstrap PPT by MukeshBootstrap PPT by Mukesh
Bootstrap PPT by Mukesh
 
Bootstrap 5 ppt
Bootstrap 5 pptBootstrap 5 ppt
Bootstrap 5 ppt
 
CSS
CSSCSS
CSS
 

En vedette

S4 tarea4 caheg
S4 tarea4 cahegS4 tarea4 caheg
S4 tarea4 cahegLUPITA_66
 
Actividad3 infopedagogía-reyes-marcelo
Actividad3 infopedagogía-reyes-marceloActividad3 infopedagogía-reyes-marcelo
Actividad3 infopedagogía-reyes-marceloSci Chaco
 
грицько бойко геніальний український письменник
грицько бойко геніальний український письменникгрицько бойко геніальний український письменник
грицько бойко геніальний український письменникtruvativ
 
astocha ppt 1. pengantar konsep integral
astocha ppt 1. pengantar konsep integralastocha ppt 1. pengantar konsep integral
astocha ppt 1. pengantar konsep integralSMKN 2 Kediri
 
CINEC represent Sri Lanka in IORA project in Australia revised
CINEC represent Sri Lanka in IORA project in Australia revised CINEC represent Sri Lanka in IORA project in Australia revised
CINEC represent Sri Lanka in IORA project in Australia revised CINEC Campus
 
AUTOMATED MODEL FOR IMPLEMENTATION OF UNIFIED CRITERIA FOR FLOOD RISK CLASSIF...
AUTOMATED MODEL FOR IMPLEMENTATION OF UNIFIED CRITERIA FOR FLOOD RISK CLASSIF...AUTOMATED MODEL FOR IMPLEMENTATION OF UNIFIED CRITERIA FOR FLOOD RISK CLASSIF...
AUTOMATED MODEL FOR IMPLEMENTATION OF UNIFIED CRITERIA FOR FLOOD RISK CLASSIF...Lyubomir Filipov
 
Some samr modell
Some samr modellSome samr modell
Some samr modellhkerm
 
обогреваемое стекло Print
обогреваемое стекло Printобогреваемое стекло Print
обогреваемое стекло Printpic-g
 
итд
итдитд
итдpic-g
 

En vedette (11)

S4 tarea4 caheg
S4 tarea4 cahegS4 tarea4 caheg
S4 tarea4 caheg
 
TREB Housing Market Charts - November 2015
TREB Housing Market Charts - November 2015TREB Housing Market Charts - November 2015
TREB Housing Market Charts - November 2015
 
Actividad3 infopedagogía-reyes-marcelo
Actividad3 infopedagogía-reyes-marceloActividad3 infopedagogía-reyes-marcelo
Actividad3 infopedagogía-reyes-marcelo
 
грицько бойко геніальний український письменник
грицько бойко геніальний український письменникгрицько бойко геніальний український письменник
грицько бойко геніальний український письменник
 
astocha ppt 1. pengantar konsep integral
astocha ppt 1. pengantar konsep integralastocha ppt 1. pengantar konsep integral
astocha ppt 1. pengantar konsep integral
 
CINEC represent Sri Lanka in IORA project in Australia revised
CINEC represent Sri Lanka in IORA project in Australia revised CINEC represent Sri Lanka in IORA project in Australia revised
CINEC represent Sri Lanka in IORA project in Australia revised
 
AUTOMATED MODEL FOR IMPLEMENTATION OF UNIFIED CRITERIA FOR FLOOD RISK CLASSIF...
AUTOMATED MODEL FOR IMPLEMENTATION OF UNIFIED CRITERIA FOR FLOOD RISK CLASSIF...AUTOMATED MODEL FOR IMPLEMENTATION OF UNIFIED CRITERIA FOR FLOOD RISK CLASSIF...
AUTOMATED MODEL FOR IMPLEMENTATION OF UNIFIED CRITERIA FOR FLOOD RISK CLASSIF...
 
Org (1)
Org (1)Org (1)
Org (1)
 
Some samr modell
Some samr modellSome samr modell
Some samr modell
 
обогреваемое стекло Print
обогреваемое стекло Printобогреваемое стекло Print
обогреваемое стекло Print
 
итд
итдитд
итд
 

Similaire à Mediaqueries

Similaire à Mediaqueries (20)

Web Programming
Web ProgrammingWeb Programming
Web Programming
 
CSS media types
CSS media typesCSS media types
CSS media types
 
Print CSS
Print CSSPrint CSS
Print CSS
 
Css
CssCss
Css
 
CSS3 Media Queries And Creating Adaptive Layouts
CSS3 Media Queries And Creating Adaptive LayoutsCSS3 Media Queries And Creating Adaptive Layouts
CSS3 Media Queries And Creating Adaptive Layouts
 
Chapter 17: Responsive Web Design
Chapter 17: Responsive Web DesignChapter 17: Responsive Web Design
Chapter 17: Responsive Web Design
 
Webpage style with CSS
Webpage style with CSSWebpage style with CSS
Webpage style with CSS
 
HTML5, CSS3 & Responsive Design
HTML5, CSS3 & Responsive DesignHTML5, CSS3 & Responsive Design
HTML5, CSS3 & Responsive Design
 
Cordova training - Day 2 Introduction to CSS 3
Cordova training - Day 2 Introduction to CSS 3Cordova training - Day 2 Introduction to CSS 3
Cordova training - Day 2 Introduction to CSS 3
 
Responsive Web Design & APEX Theme 25
Responsive Web Design & APEX Theme 25Responsive Web Design & APEX Theme 25
Responsive Web Design & APEX Theme 25
 
Introduction to Responsive Web Design
Introduction to Responsive Web DesignIntroduction to Responsive Web Design
Introduction to Responsive Web Design
 
Styles.docx
Styles.docxStyles.docx
Styles.docx
 
Styles.docx
Styles.docxStyles.docx
Styles.docx
 
Styles.docx
Styles.docxStyles.docx
Styles.docx
 
Styles1.docx
Styles1.docxStyles1.docx
Styles1.docx
 
Pfnp slides
Pfnp slidesPfnp slides
Pfnp slides
 
css-tutorial
css-tutorialcss-tutorial
css-tutorial
 
css-tutorial
css-tutorialcss-tutorial
css-tutorial
 
CSS-3 Course Slide
CSS-3 Course SlideCSS-3 Course Slide
CSS-3 Course Slide
 
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
 

Dernier

Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...PsychoTech Services
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 

Dernier (20)

Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 

Mediaqueries

  • 2. What are Media Queries? • Allows us to change our layouts to suit the exact need of different devices without changing the content. • It is applied with the help of CSS3. • Media queries are CSS extensions to media types that give us more control over rendering across different devices. • Media query is a logical expression which is either true or false. • CSS associated with media query is only applied if the expression is true.
  • 3. What are Media Types? • CSS can be used to specify how a document is presented in different media • There are ten media types defined in CSS – all : suitable for all devices. – handheld : for handheld devices. – screen : for color computer screens. – tv : for television type devices. – aural : for speech synthesizer. – braille : for braille tactile feed back devices. – embossed : for paged braille printers. – projection : for projected presentations . – tty : for teletypes and terminals. – print : for print material.
  • 4. Methods to specify Media for CSS • First method: – You can use a <link> element in the head of your HTML document to specify the target media of an external style sheet. Example: <link rel=“stylesheet” href=“a.css” type=“type/css” media=“screen”/> • Second method: – You can use a <?xml-stylesheetl?> element in the head of your XML document to specify the target media of an external style sheet. Example: <?xml-stylesheet media=“screen” rel=“stylesheet” href=“example.css”?>
  • 5. Methods to specify Media for CSS • Third method: – You can specify the target medium within a CSS file using @media Example: @media screen { body{color:blue;} }
  • 6. Media Query Syntax <style> @media screen and (color) { body{color:blue;} } </style> Media type keyword Media feature
  • 8. Types Of Keywords • and: – You can use multiple expressions in a media query if you join them with “and “ keyword. E.g.: <style> @media screen and (minwidth:200px) and (max-width:600px) { body{color:blue;} } </style>
  • 9. Types Of Keywords • Comma Separated: – You can use multiple, comma-separated media queries. – This comma act like an “or” keyword. E.g.: <style> @media screen and (minwidth:200px) or (max-width:600px) { body{color:blue;} } </style>
  • 10. Types Of Keywords • not: – You can use the not keyword in a media query if you want your CSS to be ignored by a specific device. E.g.: <style> @media not screen and (minwidth:200px) { body{color:blue;} } </style>
  • 11. Types Of Keywords • only: – You can use the only keyword in a media query if you want your CSS to be applied only to a specific device. E.g.: <style> @media only screen and (minwidth:200px) { body{color:blue;} } </style>
  • 12. Targeting iPhone • iPhone does not support hand held media type. • Apple recommends targeting the iPhone using media queries. E.g.: <style type=“text/css”> @media screen and (max-width:480px) { body{color:magenta;} } </style>
  • 13. Browser Support for Media Queries