{"id":74275,"date":"2020-01-17T12:05:49","date_gmt":"2020-01-17T06:35:49","guid":{"rendered":"https:\/\/www.vskills.in\/certification\/tutorial\/?p=74275"},"modified":"2024-04-12T14:23:24","modified_gmt":"2024-04-12T08:53:24","slug":"applying-styles-based-on-media-2","status":"publish","type":"page","link":"https:\/\/www.vskills.in\/certification\/tutorial\/applying-styles-based-on-media-2\/","title":{"rendered":"Applying Styles Based On Media"},"content":{"rendered":"<p>In CSS to differentiate styles for print from styles for the computer screen media option is used as CSS can apply to a variety of different devices and media. Hence, for different media, different media attribute is applied to the &lt;link \/&gt; element, or the &lt;style&gt; element or from within a style sheet, for different media @media rules is used.<\/p>\n<p>The different types of media that CSS can be applied to are<\/p>\n<table width=\"498\">\n<tbody>\n<tr>\n<td width=\"79\"><strong>Media Type<\/strong><\/td>\n<td width=\"419\"><strong>Description<\/strong><\/td>\n<\/tr>\n<tr>\n<td width=\"79\">all<\/td>\n<td width=\"419\">Used for all media type devices<\/td>\n<\/tr>\n<tr>\n<td width=\"79\">aural<\/td>\n<td width=\"419\">Used for speech and sound synthesizers<\/td>\n<\/tr>\n<tr>\n<td width=\"79\">braille<\/td>\n<td width=\"419\">Used for braille tactile feedback devices<\/td>\n<\/tr>\n<tr>\n<td width=\"79\">embossed<\/td>\n<td width=\"419\">Used for paged braille printers<\/td>\n<\/tr>\n<tr>\n<td width=\"79\">handheld<\/td>\n<td width=\"419\">Used for small or handheld devices<\/td>\n<\/tr>\n<tr>\n<td width=\"79\">print<\/td>\n<td width=\"419\">Used for printers<\/td>\n<\/tr>\n<tr>\n<td width=\"79\">projection<\/td>\n<td width=\"419\">Used for projected presentations, like slides<\/td>\n<\/tr>\n<tr>\n<td width=\"79\">screen<\/td>\n<td width=\"419\">Used for computer screens<\/td>\n<\/tr>\n<tr>\n<td width=\"79\">tty<\/td>\n<td width=\"419\">Used for media using a fixed-pitch character grid, like teletypes<\/td>\n<\/tr>\n<tr>\n<td width=\"79\">tv<\/td>\n<td width=\"419\">Used for television-type devices<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>The default value is all . Only screen, print and all values are widely supported in computer browsers.<\/p>\n<p>Certain CSS properties are only designed for certain media (e.g., the &#8216;page-break-before&#8217; property only applies to paged media). Sometimes style sheets for different media types may share a property, but require different values for that property. For example, the &#8216;font-size&#8217; property is useful both for screen and print media. The two media types are different enough to require different values for the common property; a document will typically need a larger font on a computer screen than on paper. Therefore, it is necessary to express that a style sheet, or a section of a style sheet, applies to certain media types.<\/p>\n<p>There are currently two ways to specify media dependencies for style sheets:<\/p>\n<ul>\n<li>Specify the target medium from a style sheet with the @media or @import at-rules as<\/li>\n<\/ul>\n<p>@import url(&#8220;fancyfonts.css&#8221;) screen;<\/p>\n<p>@media print {<\/p>\n<p>\/* style sheet for print goes here *\/ }<\/p>\n<p>@media print {<\/p>\n<p>h1 { font-size: 50pt; text-align: center; } }<\/p>\n<ul>\n<li>Specify the target medium within the document language so in HTML documents the &#8220;media&#8221; attribute on the LINK element specifies the target media of an external style sheet as<\/li>\n<\/ul>\n<p>&lt;!DOCTYPE HTML PUBLIC &#8220;-\/\/W3C\/\/DTD HTML 4.01\/\/EN&#8221;&gt;<\/p>\n<p>&lt;HTML&gt;<\/p>\n<p>&lt;HEAD&gt;<\/p>\n<p>&lt;TITLE&gt;Link to a target medium&lt;\/TITLE&gt;<\/p>\n<p>&lt;LINK REL=&#8221;stylesheet&#8221; TYPE=&#8221;text\/css&#8221;<\/p>\n<p>MEDIA=&#8221;print, handheld&#8221; HREF=&#8221;other.css&#8221;&gt;<\/p>\n<p>&lt;\/HEAD&gt;<\/p>\n<p>&lt;BODY&gt;<\/p>\n<p>&lt;P&gt;The body&#8230;<\/p>\n<p>&lt;\/BODY&gt;<\/p>\n<p>&lt;\/HTML&gt;<\/p>\n<p>or<\/p>\n<p>&lt;style type=\u201dtext\/css\u201d media=\u201dscreen\u201d&gt;&lt;\/style&gt;<\/p>\n<p>Print preview option in the browser shows what the page will look like when it is printed<\/p>\n<h5 id=\"block-07feabc5-3923-4122-ba70-f7cf1db64a8f\" class=\"block-editor-block-list__block wp-block is-selected rich-text block-editor-rich-text__editable is-hovered wp-block\" tabindex=\"0\" role=\"textbox\" contenteditable=\"true\" aria-label=\"Write heading\u2026\" aria-multiline=\"true\" data-block=\"07feabc5-3923-4122-ba70-f7cf1db64a8f\" data-type=\"core\/heading\" data-title=\"Heading\">Go To-\u00a0<a href=\"https:\/\/www.vskills.in\/certification\/tutorial\/certified-css3-developer\/\" target=\"_blank\" rel=\"noreferrer noopener\"><strong>Certified CSS3 Developer<\/strong>\u00a0<strong>Tutorial<\/strong><\/a><\/h5>\n","protected":false},"excerpt":{"rendered":"<p>In CSS to differentiate styles for print from styles for the computer screen media option is used as CSS can apply to a variety of different devices and media. Hence, for different media, different media attribute is applied to the &lt;link \/&gt; element, or the &lt;style&gt; element or from within a style sheet, for different&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"categories":[8568],"tags":[1849],"class_list":["post-74275","page","type-page","status-publish","hentry","category-css3","tag-applying-styles-based-on-media"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Applying Styles Based On Media - Tutorial<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.vskills.in\/certification\/tutorial\/applying-styles-based-on-media-2\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Applying Styles Based On Media - Tutorial\" \/>\n<meta property=\"og:description\" content=\"In CSS to differentiate styles for print from styles for the computer screen media option is used as CSS can apply to a variety of different devices and media. Hence, for different media, different media attribute is applied to the &lt;link \/&gt; element, or the &lt;style&gt; element or from within a style sheet, for different...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.vskills.in\/certification\/tutorial\/applying-styles-based-on-media-2\/\" \/>\n<meta property=\"og:site_name\" content=\"Tutorial\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/vskills.in\/\" \/>\n<meta property=\"article:modified_time\" content=\"2024-04-12T08:53:24+00:00\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/applying-styles-based-on-media-2\/\",\"url\":\"https:\/\/www.vskills.in\/certification\/tutorial\/applying-styles-based-on-media-2\/\",\"name\":\"Applying Styles Based On Media - Tutorial\",\"isPartOf\":{\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#website\"},\"datePublished\":\"2020-01-17T06:35:49+00:00\",\"dateModified\":\"2024-04-12T08:53:24+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/applying-styles-based-on-media-2\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.vskills.in\/certification\/tutorial\/applying-styles-based-on-media-2\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/applying-styles-based-on-media-2\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.vskills.in\/certification\/tutorial\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Applying Styles Based On Media\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#website\",\"url\":\"https:\/\/www.vskills.in\/certification\/tutorial\/\",\"name\":\"Tutorial\",\"description\":\"Vskills - A initiative in elearning and certification\",\"publisher\":{\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.vskills.in\/certification\/tutorial\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#organization\",\"name\":\"Vskills\",\"url\":\"https:\/\/www.vskills.in\/certification\/tutorial\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2017\/07\/vskills-min-logo.jpg\",\"contentUrl\":\"https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2017\/07\/vskills-min-logo.jpg\",\"width\":73,\"height\":55,\"caption\":\"Vskills\"},\"image\":{\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/vskills.in\/\",\"https:\/\/x.com\/vskills_in\",\"https:\/\/www.linkedin.com\/company-beta\/1371554\/\",\"https:\/\/www.youtube.com\/channel\/UCMWnscxPwRF_PqXo9B7q_Tw\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Applying Styles Based On Media - Tutorial","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.vskills.in\/certification\/tutorial\/applying-styles-based-on-media-2\/","og_locale":"en_US","og_type":"article","og_title":"Applying Styles Based On Media - Tutorial","og_description":"In CSS to differentiate styles for print from styles for the computer screen media option is used as CSS can apply to a variety of different devices and media. Hence, for different media, different media attribute is applied to the &lt;link \/&gt; element, or the &lt;style&gt; element or from within a style sheet, for different...","og_url":"https:\/\/www.vskills.in\/certification\/tutorial\/applying-styles-based-on-media-2\/","og_site_name":"Tutorial","article_publisher":"https:\/\/www.facebook.com\/vskills.in\/","article_modified_time":"2024-04-12T08:53:24+00:00","twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/applying-styles-based-on-media-2\/","url":"https:\/\/www.vskills.in\/certification\/tutorial\/applying-styles-based-on-media-2\/","name":"Applying Styles Based On Media - Tutorial","isPartOf":{"@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#website"},"datePublished":"2020-01-17T06:35:49+00:00","dateModified":"2024-04-12T08:53:24+00:00","breadcrumb":{"@id":"https:\/\/www.vskills.in\/certification\/tutorial\/applying-styles-based-on-media-2\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.vskills.in\/certification\/tutorial\/applying-styles-based-on-media-2\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/applying-styles-based-on-media-2\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.vskills.in\/certification\/tutorial\/"},{"@type":"ListItem","position":2,"name":"Applying Styles Based On Media"}]},{"@type":"WebSite","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#website","url":"https:\/\/www.vskills.in\/certification\/tutorial\/","name":"Tutorial","description":"Vskills - A initiative in elearning and certification","publisher":{"@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.vskills.in\/certification\/tutorial\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#organization","name":"Vskills","url":"https:\/\/www.vskills.in\/certification\/tutorial\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#\/schema\/logo\/image\/","url":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2017\/07\/vskills-min-logo.jpg","contentUrl":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2017\/07\/vskills-min-logo.jpg","width":73,"height":55,"caption":"Vskills"},"image":{"@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/vskills.in\/","https:\/\/x.com\/vskills_in","https:\/\/www.linkedin.com\/company-beta\/1371554\/","https:\/\/www.youtube.com\/channel\/UCMWnscxPwRF_PqXo9B7q_Tw"]}]}},"_links":{"self":[{"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/pages\/74275","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/comments?post=74275"}],"version-history":[{"count":4,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/pages\/74275\/revisions"}],"predecessor-version":[{"id":85717,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/pages\/74275\/revisions\/85717"}],"wp:attachment":[{"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/media?parent=74275"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/categories?post=74275"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/tags?post=74275"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}