Reputation: 593
I'm using asp mvc, and I'm using the following code to generate the CSS html reference:
@Styles.Render("~/Content/css")
which generates the following html:
<link href="/Content/site.css" rel="stylesheet"/>
and that works fine. However, I need to add media type as an additional attribute. How can I go about using this style.render to add attributes to the generated html? Should I be thinking about making the change in the bundle config instead?
edit: I would like the end product to look like this:
<link href="/Content/site.css" rel="stylesheet" media="handheld"/>
Upvotes: 4
Views: 5204
Reputation: 1898
Try this
< link href="@Styles.Url("~/Content/css")" rel="stylesheet" type="text/css" media="handheld" />
Upvotes: 4
Reputation: 49105
You should be using @Styles.RenderFormat()
for that:
@Styles.RenderFormat(@"<link href=""{0}""
rel=""stylesheet""
media=""handheld"" />",
"~/Content/css")
Upvotes: 11