SlideShare a Scribd company logo
CSS
MEDIA TYPES
CSS can be used to specify
how a document is presented
    in different media.
We can determine which CSS
  rules are given to specific devices
      using the media attribute:

<link rel="stylesheet” href="a.css”
type="text/css" media="screen" />

<link rel="stylesheet” href="a.css"
type="text/css" media="print" />
So, what are
possible media
   types?
There are ten media types
    defined in CSS 2.1
all   suitable for all devices
     aural    for speech synthesizers
    braille   for Braille tactile feedback devices
embossed      for paged Braille printers
 handheld     for handheld devices
     print    for print material
projection    for projected presentations
   screen     for color computer screens
        tty   for teletypes and terminals
         tv   for television type devices
Unfortunately, many of these
 media types are not well
  supported by devices.

 The only safe options are:

             all
            print
           screen
Are there
 different
methods we
 can use?
There are five methods that can
   be used to specify media
        for style sheets.
Method 1:
<link> within HTML
You can use a <link> element in
the head of your HTML document
 to specify the target media of an
       external style sheet.



  <link rel="stylesheet"
  href="a.css" type="text/css"
  media=”screen" />
You can also specify multiple
media types (each separated with
  a comma) using this method:




  <link rel="stylesheet"
  href="a.css" type="text/css"
  media=”screen, print" />
You can also specify all media
types or leave the media type out
  all together (which defaults the
         media type to “all”)



  <link rel="stylesheet"
  href="a.css" type="text/css"
  media="all" />
Method 2:
<?xml stylesheet>
   within XML
You can use <?xml-stylesheet ?>
in the head of your XML document
  to specify the target media of an
        external style sheet.



  <?xml-stylesheet
  href="a.css" rel="stylesheet"
  media="screen" ?>
You can also specify multiple
media types (each separated with
  a comma) using this method:




  <?xml-stylesheet
  href="a.css" rel="stylesheet"
  media="screen, print" ?>
You can also specify all media
types or leave the media type out
  all together (which defaults the
         media type to “all”)



  <?xml-stylesheet
  href="a.css" rel="stylesheet"
  media="all" ?>
Method 3:
@import within
   HTML
You can use @import in the head
if your HTML document to specify
   the target media of an external
             style sheet.



  <style type="text/css"
  media="screen">
  @import "a.css";</style>
You can also specify multiple
media types (each separated with
  a comma) using this method:




  <style type="text/css"
  media="screen, print">
  @import "a.css";</style>
You can also specify all media
types or leave the media type out
  all together (which defaults the
         media type to “all”)



  <style type="text/css"
  media="all">
  @import "a.css";</style>
Warning:
              @import should be avoided as it
                can cause issues in some
               versions of Internet Explorer.




http://www.stevesouders.com/blog/2009/04/09/dont-use-import/
Method 4:
@import within CSS
You can specify the target medium
 within a CSS file using @import




  @import url("a.css") screen;
You can also specify multiple
media types (each separated with
  a comma) using this method:




  @import url("a.css") screen,
  print;
You can also specify all media
types or leave the media type out
  all together (which defaults the
         media type to “all”)



  @import url("a.css") all;
Media-types within @import
rules are not supported by IE5,
IE6 or IE7. The rule is ignored.
Method 5:
@media within CSS
You can specify the target medium
 within a CSS file using @media




  @media screen
  {
  !   body { color: blue; }
  }
You can also specify multiple
media types (each separated with
  a comma) using this method:




  @media screen, print
  {
  !   body { color: blue; }
  }
You can also specify all media
types or leave the media type out
  all together (which defaults the
         media type to “all”)



  @media
  {
  !   body { color: blue; }
  }
What is this
 @media?
@media is one of the four
  CSS2.1 at rules. At-rules start
  with an '@' character followed
immediately by an identifier (such
           as “media”).
@media rules can sit anywhere
   inside an external CSS style
              sheet.


body { color: red; }

@media screen
{
!   body { color: blue; }
}
@media rules include the
   @media statement, followed by
  an optional media type, followed
    by a start and end bracket.

@media screen
{
!   /* your rules here */
}
Any standard CSS rule can be
   added inside these brackets.


@media screen
{
!   p { color: red; }
!   #nav { float: left; }
!   .intro { font-weight: bold; }!
}
External style sheets can included
 one or more @media rules, each
   targeting different devices.


@media screen { }
@media print { }
While the entire CSS file will be
     parsed by different types of
    devices, each device will only
   apply the rules assigned to it,
      based on the media type.


@media screen { }
@media print { }
Note:
    If you want to specify more than
    one media type inside one CSS
 file, make sure your <link> element
      uses a media type of “all” or
  leave the media type undefined...

<link rel="stylesheet” href="a.css”
type="text/css" media=”all" />
Otherwise all the other different
 types of devices will not follow
the link to the external style sheet
               at all.
Why use
@media?
The main advantage of @media
   is that you can use one CSS file
       to control different media.



@media screen { }
@media print { }
This means there are less hits to
the server, and only one link in
 your HTML files, which makes
      maintenance easier.
Russ Weakley
Max Design

Site: maxdesign.com.au
Twitter: twitter.com/russmaxdesign
Slideshare: slideshare.net/maxdesign
Linkedin: linkedin.com/in/russweakley

More Related Content

What's hot

Css selectors
Css selectorsCss selectors
Css selectors
Parth Trivedi
 
Cascading style sheet
Cascading style sheetCascading style sheet
Cascading style sheet
Michael Jhon
 
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
 
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
 
HTML
HTMLHTML
(Fast) Introduction to HTML & CSS
(Fast) Introduction to HTML & CSS (Fast) Introduction to HTML & CSS
(Fast) Introduction to HTML & CSS
Dave Kelly
 
Span and Div tags in HTML
Span and Div tags in HTMLSpan and Div tags in HTML
Span and Div tags in HTML
Biswadip Goswami
 
Css
CssCss
Introduction to HTML and CSS
Introduction to HTML and CSSIntroduction to HTML and CSS
Introduction to HTML and CSS
Mario Hernandez
 
Css ppt
Css pptCss ppt
Css ppt
Nidhi mishra
 
CSS3, Media Queries, and Responsive Design
CSS3, Media Queries, and Responsive DesignCSS3, Media Queries, and Responsive Design
CSS3, Media Queries, and Responsive Design
Zoe Gillenwater
 
CSS
CSSCSS
Understanding XML DOM
Understanding XML DOMUnderstanding XML DOM
Understanding XML DOM
Om Vikram Thapa
 
CSS3 Media Queries
CSS3 Media QueriesCSS3 Media Queries
CSS3 Media Queries
Russ Weakley
 
Xhtml
XhtmlXhtml
Xhtml
Abdul Khan
 
html-css
html-csshtml-css

What's hot (20)

Css selectors
Css selectorsCss selectors
Css selectors
 
Cascading style sheet
Cascading style sheetCascading style sheet
Cascading style sheet
 
Html and css
Html and cssHtml and css
Html and css
 
How Cascading Style Sheets (CSS) Works
How Cascading Style Sheets (CSS) WorksHow Cascading Style Sheets (CSS) Works
How Cascading Style Sheets (CSS) Works
 
Introduction to Cascading Style Sheets (CSS)
Introduction to Cascading Style Sheets (CSS)Introduction to Cascading Style Sheets (CSS)
Introduction to Cascading Style Sheets (CSS)
 
HTML
HTMLHTML
HTML
 
(Fast) Introduction to HTML & CSS
(Fast) Introduction to HTML & CSS (Fast) Introduction to HTML & CSS
(Fast) Introduction to HTML & CSS
 
Span and Div tags in HTML
Span and Div tags in HTMLSpan and Div tags in HTML
Span and Div tags in HTML
 
Css
CssCss
Css
 
Html frames
Html framesHtml frames
Html frames
 
Introduction to HTML and CSS
Introduction to HTML and CSSIntroduction to HTML and CSS
Introduction to HTML and CSS
 
Css ppt
Css pptCss ppt
Css ppt
 
Html Frames
Html FramesHtml Frames
Html Frames
 
CSS3, Media Queries, and Responsive Design
CSS3, Media Queries, and Responsive DesignCSS3, Media Queries, and Responsive Design
CSS3, Media Queries, and Responsive Design
 
CSS
CSSCSS
CSS
 
Understanding XML DOM
Understanding XML DOMUnderstanding XML DOM
Understanding XML DOM
 
CSS3 Media Queries
CSS3 Media QueriesCSS3 Media Queries
CSS3 Media Queries
 
Html Ppt
Html PptHtml Ppt
Html Ppt
 
Xhtml
XhtmlXhtml
Xhtml
 
html-css
html-csshtml-css
html-css
 

Viewers also liked

Types of media
Types of mediaTypes of media
Types of media
sevianj
 
Media and types of communication
Media and types of communicationMedia and types of communication
Media and types of communicationAnuj STha
 
Different Types of Mass Media
Different Types of Mass MediaDifferent Types of Mass Media
Different Types of Mass Media
decorousassista38
 
Different types of news powerpoint presentation
Different types of news powerpoint presentationDifferent types of news powerpoint presentation
Different types of news powerpoint presentationABoksh
 
Ch 14 business management ppt
Ch 14 business management pptCh 14 business management ppt
Ch 14 business management ppt
Rebecca Buck
 
11.2 Marketing a Small Business Advertising Presentation 2
11.2 Marketing a Small Business Advertising Presentation 211.2 Marketing a Small Business Advertising Presentation 2
11.2 Marketing a Small Business Advertising Presentation 2
NCVPS
 
What is social media?
What is social media?What is social media?
What is social media?
Swapnil Bagul
 
Social Media
Social MediaSocial Media
Social Media
Alex Wong
 

Viewers also liked (12)

Types of media
Types of mediaTypes of media
Types of media
 
Media and types of communication
Media and types of communicationMedia and types of communication
Media and types of communication
 
Media types
Media typesMedia types
Media types
 
Different Types of Mass Media
Different Types of Mass MediaDifferent Types of Mass Media
Different Types of Mass Media
 
Different types of news powerpoint presentation
Different types of news powerpoint presentationDifferent types of news powerpoint presentation
Different types of news powerpoint presentation
 
Ch 14 business management ppt
Ch 14 business management pptCh 14 business management ppt
Ch 14 business management ppt
 
11.2 Marketing a Small Business Advertising Presentation 2
11.2 Marketing a Small Business Advertising Presentation 211.2 Marketing a Small Business Advertising Presentation 2
11.2 Marketing a Small Business Advertising Presentation 2
 
News
NewsNews
News
 
Media types
Media typesMedia types
Media types
 
Mass media
Mass mediaMass media
Mass media
 
What is social media?
What is social media?What is social media?
What is social media?
 
Social Media
Social MediaSocial Media
Social Media
 

Similar to CSS media types

Print CSS
Print CSSPrint CSS
Print CSS
Russ Weakley
 
Mediaqueries
MediaqueriesMediaqueries
Mediaqueries
Brillio
 
Pfnp slides
Pfnp slidesPfnp slides
Pfnp slides
William Myers
 
Web Programming
Web ProgrammingWeb Programming
Web Programming
NilaNila16
 
Css and its types
Css and its typesCss and its types
Css and its types
Mansi Mahadik
 
Cascading Style Sheets (CSS)
Cascading Style Sheets (CSS)Cascading Style Sheets (CSS)
Cascading Style Sheets (CSS)
Harshil Darji
 
CSS Training in Bangalore
CSS Training in BangaloreCSS Training in Bangalore
CSS Training in Bangalore
rajkamal560066
 
Cascading Style Sheets - CSS - Tutorial
Cascading Style Sheets - CSS  -  TutorialCascading Style Sheets - CSS  -  Tutorial
Cascading Style Sheets - CSS - Tutorial
MSA Technosoft
 
Media queries A to Z
Media queries A to ZMedia queries A to Z
Media queries A to Z
Shameem Reza
 
Cascading Style Sheets - Part 02
Cascading Style Sheets - Part 02Cascading Style Sheets - Part 02
Cascading Style Sheets - Part 02
Hatem Mahmoud
 
using cascading style sheets-presentation.ppt
using cascading style sheets-presentation.pptusing cascading style sheets-presentation.ppt
using cascading style sheets-presentation.ppt
KADAMBARIPUROHIT
 
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
QA TrainingHub
 

Similar to CSS media types (20)

Print CSS
Print CSSPrint CSS
Print CSS
 
Mediaqueries
MediaqueriesMediaqueries
Mediaqueries
 
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
CssCss
Css
 
Web Programming
Web ProgrammingWeb Programming
Web Programming
 
Css
CssCss
Css
 
Css and its types
Css and its typesCss and its types
Css and its types
 
Cascading Style Sheets (CSS)
Cascading Style Sheets (CSS)Cascading Style Sheets (CSS)
Cascading Style Sheets (CSS)
 
CSS Training in Bangalore
CSS Training in BangaloreCSS Training in Bangalore
CSS Training in Bangalore
 
Cascading Style Sheets - CSS - Tutorial
Cascading Style Sheets - CSS  -  TutorialCascading Style Sheets - CSS  -  Tutorial
Cascading Style Sheets - CSS - Tutorial
 
Css
CssCss
Css
 
Media queries A to Z
Media queries A to ZMedia queries A to Z
Media queries A to Z
 
Lecture-6.pptx
Lecture-6.pptxLecture-6.pptx
Lecture-6.pptx
 
Cascading Style Sheets - Part 02
Cascading Style Sheets - Part 02Cascading Style Sheets - Part 02
Cascading Style Sheets - Part 02
 
using cascading style sheets-presentation.ppt
using cascading style sheets-presentation.pptusing cascading style sheets-presentation.ppt
using cascading style sheets-presentation.ppt
 
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
 

More from Russ Weakley

Accessible chat windows
Accessible chat windowsAccessible chat windows
Accessible chat windows
Russ Weakley
 
Accessible names & descriptions
Accessible names & descriptionsAccessible names & descriptions
Accessible names & descriptions
Russ Weakley
 
A deep dive into accessible names
A deep dive into accessible namesA deep dive into accessible names
A deep dive into accessible names
Russ Weakley
 
What are accessible names and why should you care?
What are accessible names and why should you care?What are accessible names and why should you care?
What are accessible names and why should you care?
Russ Weakley
 
How to build accessible UI components
How to build accessible UI componentsHow to build accessible UI components
How to build accessible UI components
Russ Weakley
 
What is WCAG 2 and why should we care?
What is WCAG 2 and why should we care?What is WCAG 2 and why should we care?
What is WCAG 2 and why should we care?
Russ Weakley
 
Accessible states in Design Systems
Accessible states in Design SystemsAccessible states in Design Systems
Accessible states in Design Systems
Russ Weakley
 
Creating accessible modals and autocompletes
Creating accessible modals and autocompletesCreating accessible modals and autocompletes
Creating accessible modals and autocompletes
Russ Weakley
 
Building an accessible progressive loader
Building an accessible progressive loaderBuilding an accessible progressive loader
Building an accessible progressive loader
Russ Weakley
 
Accessibility in Design systems - the pain and glory
Accessibility in Design systems - the pain and gloryAccessibility in Design systems - the pain and glory
Accessibility in Design systems - the pain and glory
Russ Weakley
 
Accessible Inline errors messages
Accessible Inline errors messagesAccessible Inline errors messages
Accessible Inline errors messages
Russ Weakley
 
Accessible Form Hints and Errors
Accessible Form Hints and ErrorsAccessible Form Hints and Errors
Accessible Form Hints and Errors
Russ Weakley
 
What is accessibility?
What is accessibility?What is accessibility?
What is accessibility?
Russ Weakley
 
Accessibility in Pattern Libraries
Accessibility in Pattern LibrariesAccessibility in Pattern Libraries
Accessibility in Pattern Libraries
Russ Weakley
 
Accessibility in pattern libraries
Accessibility in pattern librariesAccessibility in pattern libraries
Accessibility in pattern libraries
Russ Weakley
 
Building an accessible auto-complete - #ID24
Building an accessible auto-complete - #ID24Building an accessible auto-complete - #ID24
Building an accessible auto-complete - #ID24
Russ Weakley
 
Building an accessible auto-complete
Building an accessible auto-completeBuilding an accessible auto-complete
Building an accessible auto-complete
Russ Weakley
 
Creating Acessible floating labels
Creating Acessible floating labelsCreating Acessible floating labels
Creating Acessible floating labels
Russ Weakley
 
Creating an Accessible button dropdown
Creating an Accessible button dropdownCreating an Accessible button dropdown
Creating an Accessible button dropdown
Russ Weakley
 
Creating a Simple, Accessible On/Off Switch
Creating a Simple, Accessible On/Off SwitchCreating a Simple, Accessible On/Off Switch
Creating a Simple, Accessible On/Off Switch
Russ Weakley
 

More from Russ Weakley (20)

Accessible chat windows
Accessible chat windowsAccessible chat windows
Accessible chat windows
 
Accessible names & descriptions
Accessible names & descriptionsAccessible names & descriptions
Accessible names & descriptions
 
A deep dive into accessible names
A deep dive into accessible namesA deep dive into accessible names
A deep dive into accessible names
 
What are accessible names and why should you care?
What are accessible names and why should you care?What are accessible names and why should you care?
What are accessible names and why should you care?
 
How to build accessible UI components
How to build accessible UI componentsHow to build accessible UI components
How to build accessible UI components
 
What is WCAG 2 and why should we care?
What is WCAG 2 and why should we care?What is WCAG 2 and why should we care?
What is WCAG 2 and why should we care?
 
Accessible states in Design Systems
Accessible states in Design SystemsAccessible states in Design Systems
Accessible states in Design Systems
 
Creating accessible modals and autocompletes
Creating accessible modals and autocompletesCreating accessible modals and autocompletes
Creating accessible modals and autocompletes
 
Building an accessible progressive loader
Building an accessible progressive loaderBuilding an accessible progressive loader
Building an accessible progressive loader
 
Accessibility in Design systems - the pain and glory
Accessibility in Design systems - the pain and gloryAccessibility in Design systems - the pain and glory
Accessibility in Design systems - the pain and glory
 
Accessible Inline errors messages
Accessible Inline errors messagesAccessible Inline errors messages
Accessible Inline errors messages
 
Accessible Form Hints and Errors
Accessible Form Hints and ErrorsAccessible Form Hints and Errors
Accessible Form Hints and Errors
 
What is accessibility?
What is accessibility?What is accessibility?
What is accessibility?
 
Accessibility in Pattern Libraries
Accessibility in Pattern LibrariesAccessibility in Pattern Libraries
Accessibility in Pattern Libraries
 
Accessibility in pattern libraries
Accessibility in pattern librariesAccessibility in pattern libraries
Accessibility in pattern libraries
 
Building an accessible auto-complete - #ID24
Building an accessible auto-complete - #ID24Building an accessible auto-complete - #ID24
Building an accessible auto-complete - #ID24
 
Building an accessible auto-complete
Building an accessible auto-completeBuilding an accessible auto-complete
Building an accessible auto-complete
 
Creating Acessible floating labels
Creating Acessible floating labelsCreating Acessible floating labels
Creating Acessible floating labels
 
Creating an Accessible button dropdown
Creating an Accessible button dropdownCreating an Accessible button dropdown
Creating an Accessible button dropdown
 
Creating a Simple, Accessible On/Off Switch
Creating a Simple, Accessible On/Off SwitchCreating a Simple, Accessible On/Off Switch
Creating a Simple, Accessible On/Off Switch
 

Recently uploaded

Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
RaedMohamed3
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
vaibhavrinwa19
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
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
Po-Chuan Chen
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
Peter Windle
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
GeoBlogs
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
MIRIAMSALINAS13
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
Peter Windle
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
timhan337
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 

Recently uploaded (20)

Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
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
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 

CSS media types

  • 2. CSS can be used to specify how a document is presented in different media.
  • 3. We can determine which CSS rules are given to specific devices using the media attribute: <link rel="stylesheet” href="a.css” type="text/css" media="screen" /> <link rel="stylesheet” href="a.css" type="text/css" media="print" />
  • 4. So, what are possible media types?
  • 5. There are ten media types defined in CSS 2.1
  • 6. all suitable for all devices aural for speech synthesizers braille for Braille tactile feedback devices embossed for paged Braille printers handheld for handheld devices print for print material projection for projected presentations screen for color computer screens tty for teletypes and terminals tv for television type devices
  • 7. Unfortunately, many of these media types are not well supported by devices. The only safe options are: all print screen
  • 9. There are five methods that can be used to specify media for style sheets.
  • 11. You can use a <link> element in the head of your HTML document to specify the target media of an external style sheet. <link rel="stylesheet" href="a.css" type="text/css" media=”screen" />
  • 12. You can also specify multiple media types (each separated with a comma) using this method: <link rel="stylesheet" href="a.css" type="text/css" media=”screen, print" />
  • 13. You can also specify all media types or leave the media type out all together (which defaults the media type to “all”) <link rel="stylesheet" href="a.css" type="text/css" media="all" />
  • 15. You can use <?xml-stylesheet ?> in the head of your XML document to specify the target media of an external style sheet. <?xml-stylesheet href="a.css" rel="stylesheet" media="screen" ?>
  • 16. You can also specify multiple media types (each separated with a comma) using this method: <?xml-stylesheet href="a.css" rel="stylesheet" media="screen, print" ?>
  • 17. You can also specify all media types or leave the media type out all together (which defaults the media type to “all”) <?xml-stylesheet href="a.css" rel="stylesheet" media="all" ?>
  • 19. You can use @import in the head if your HTML document to specify the target media of an external style sheet. <style type="text/css" media="screen"> @import "a.css";</style>
  • 20. You can also specify multiple media types (each separated with a comma) using this method: <style type="text/css" media="screen, print"> @import "a.css";</style>
  • 21. You can also specify all media types or leave the media type out all together (which defaults the media type to “all”) <style type="text/css" media="all"> @import "a.css";</style>
  • 22. Warning: @import should be avoided as it can cause issues in some versions of Internet Explorer. http://www.stevesouders.com/blog/2009/04/09/dont-use-import/
  • 24. You can specify the target medium within a CSS file using @import @import url("a.css") screen;
  • 25. You can also specify multiple media types (each separated with a comma) using this method: @import url("a.css") screen, print;
  • 26. You can also specify all media types or leave the media type out all together (which defaults the media type to “all”) @import url("a.css") all;
  • 27. Media-types within @import rules are not supported by IE5, IE6 or IE7. The rule is ignored.
  • 29. You can specify the target medium within a CSS file using @media @media screen { ! body { color: blue; } }
  • 30. You can also specify multiple media types (each separated with a comma) using this method: @media screen, print { ! body { color: blue; } }
  • 31. You can also specify all media types or leave the media type out all together (which defaults the media type to “all”) @media { ! body { color: blue; } }
  • 32. What is this @media?
  • 33. @media is one of the four CSS2.1 at rules. At-rules start with an '@' character followed immediately by an identifier (such as “media”).
  • 34. @media rules can sit anywhere inside an external CSS style sheet. body { color: red; } @media screen { ! body { color: blue; } }
  • 35. @media rules include the @media statement, followed by an optional media type, followed by a start and end bracket. @media screen { ! /* your rules here */ }
  • 36. Any standard CSS rule can be added inside these brackets. @media screen { ! p { color: red; } ! #nav { float: left; } ! .intro { font-weight: bold; }! }
  • 37. External style sheets can included one or more @media rules, each targeting different devices. @media screen { } @media print { }
  • 38. While the entire CSS file will be parsed by different types of devices, each device will only apply the rules assigned to it, based on the media type. @media screen { } @media print { }
  • 39. Note: If you want to specify more than one media type inside one CSS file, make sure your <link> element uses a media type of “all” or leave the media type undefined... <link rel="stylesheet” href="a.css” type="text/css" media=”all" />
  • 40. Otherwise all the other different types of devices will not follow the link to the external style sheet at all.
  • 42. The main advantage of @media is that you can use one CSS file to control different media. @media screen { } @media print { }
  • 43. This means there are less hits to the server, and only one link in your HTML files, which makes maintenance easier.
  • 44. Russ Weakley Max Design Site: maxdesign.com.au Twitter: twitter.com/russmaxdesign Slideshare: slideshare.net/maxdesign Linkedin: linkedin.com/in/russweakley