This project is read-only.

link style sheet with media attribute

Topics: Writing themes
Apr 10, 2013 at 3:46 PM
Is it possible to add a style sheet with a media attribute link this:
<link rel="stylesheet" href="core.css" media="screen"/>
<link rel="stylesheet" href="handheld.css" media="handheld, only screen and (max-device-width:480px)"/>

im trying to set something up like in this tutorial

and ive fallen at the first hurdle. DOH!
Apr 10, 2013 at 6:12 PM
just in case somebody else needs to know....

it seems like if you add this to your layout.cshtml file it'll work.
RegisterLink(new LinkEntry { Rel = "stylesheet", Type="text/css", Href = Href("../Styles/core.css")}.AddAttribute("media", "screen"));
RegisterLink(new LinkEntry { Rel = "stylesheet", Type="text/css", Href = Href("../Styles/handheld.css")}.AddAttribute("media", "handheld, only screen and (max-device-width:480px)"));

renders as:
<link href="/Themes/amoss/Styles/core.css" media="screen" rel="stylesheet" type="text/css">
<link href="/Themes/amoss/Styles/handheld.css" media="handheld, only screen and (max-device-width:480px)" rel="stylesheet" type="text/css">

Apr 10, 2013 at 6:12 PM
2.5hrs well spent ahem