homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / HTML
Forum Library, Charter, Moderators: incrediBILL

HTML Forum

Media Attribute in Link Tags

 4:45 am on Sep 8, 2013 (gmt 0)

<link rel="alternate" media="handheld" href="http://m.example.com" />

I've seen this, and variations of this, used a lot to direct (I assume) search engines to the appropriate versions of a web page. But I have never been able to find an authoritative list of media types anywhere. Does one exist? Are there media types for tables for example? Not quite mobile, not quite standard web? Are there media types for ancient/obsolete browsers? It's a hard thing to search for, because all of the words involved are so generic. "link alternate media tag"



 7:23 am on Sep 8, 2013 (gmt 0)


Don't try to get fancy.


 10:35 pm on Sep 8, 2013 (gmt 0)

Actually, this is the one he wants: [w3.org...]


 10:30 am on Sep 19, 2013 (gmt 0)

Not sure about the HTML4 reference -- The recognized/accepted media types are actually defined by CSS.

Here's the most recent list of types, which happens to be the same as the one Lucy24 posted [CSS3 -- the one I linked -- is not yet the recommendation]. Notice the lists in CSS2.1 and CSS3 are not exactly the same as the list linked from the HTML4* docs:


* The HTML4 documentation links to a list of types with Aural and without Speech or Embossed -- http://www.w3.org/TR/html401/types.html#type-media-descriptors -- but Aural has been deprecated and Speech + Embossed have been added since at least CSS2.1 (June 2011)


 2:29 pm on Sep 19, 2013 (gmt 0)

The recognized/accepted media types are actually defined by CSS.

That's not what he's using. He's using a HTML attribute for media.


 4:53 pm on Sep 19, 2013 (gmt 0)

The types of media allowed in HTML attributes are still now [as of HTML5] defined by the CSS specs, not HTML -- If you can find a list like you linked in the HTML5 docs, please post a link. My guess is if you look for very long all you'll end up with is a headache after being constantly referred to the CSS docs, but it's possible there's something I missed.


 6:04 pm on Sep 19, 2013 (gmt 0)

There is a list defined within HTML 4.01.

Future versions of HTML may introduce new values and may allow parameterized values.


 6:20 pm on Sep 19, 2013 (gmt 0)

There is a list defined within HTML 4.01.

Future versions of HTML may introduce new values and may allow parameterized values.

They already have and it's been switched to CSS. That's why I posted.

The HTML4 list -- All emphasis below added:



Note: CSS2 had a similar media type called 'aural' for this purpose. See the appendix on aural style sheets for details.

[The preceding is in reference to the addition of "screen" and deprecation of "aural" in CSS 2.1 -- Currently the CSS recommendation.]


We expect that in a future level of CSS there will be new properties and values defined for speech output. Therefore CSS 2.1 reserves the 'speech' media type (see chapter 7, "Media types"), but does not yet define which properties do or do not apply to it.

The properties in this appendix apply to a media type 'aural', that was introduced in CSS2. The type 'aural' is now deprecated.



 7:01 pm on Sep 19, 2013 (gmt 0)

A couple more references -- Again emphasis added:
The media attribute says which media the resource applies to. The value must be a valid media query. [valid media query is linked to http://www.w3.org/html/wg/drafts/html/master/infrastructure.html#valid-media-query]

Source: http://www.w3.org/html/wg/drafts/html/master/document-metadata.html#attr-link-media

A string is a valid media query if it matches the media_query_list production of the Media Queries specification. [MQ] [MQ is linked to http://www.w3.org/html/wg/drafts/html/master/references.html#refsMQ -- which links to -- http://www.w3.org/TR/css3-mediaqueries/

Source: http://www.w3.org/html/wg/drafts/html/master/infrastructure.html#valid-media-query

The ‘print’ and ‘screen’ media types are defined in HTML4. The complete list of media types in HTML4 is: ‘aural’, ‘braille’, ‘handheld’, ‘print’, ‘projection’, ‘screen’, ‘tty’, ‘tv’. CSS2 defines the same list, deprecates ‘aural’ and adds ‘embossed’ and ‘speech’. Also, ‘all’ is used to indicate that the style sheet applies to all media types.

Source: http://www.w3.org/TR/css3-mediaqueries/

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / HTML
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved