如何添加媒体属性到ASP.NET MVC4样式包 [英] How to add media attribute to ASP.NET MVC4 style bundle
本文介绍了如何添加媒体属性到ASP.NET MVC4样式包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在ASP.NET MVC4应用程序中,使用
In ASP.NET MVC4 application, style bundle is created using
bundles.Add(new StyleBundle("~/css/pos.css")
.Include("~/css/mypos.css"));
并以
@Styles.Render("~/css/pos.css")
调试模式下生成的输出是
Generated output in debug mode is
<link href="/myapp/css/mypos.css" rel="stylesheet"/>
如何向媒体属性添加媒体属性,使风格用于屏幕
How to add media attribute to output so that style is used for screen
<link href="/myapp/css/mypos.css" media="screen" rel="stylesheet"/>
或打印
<link href="/myapp/css/mypos.css" media="print" rel="stylesheet"/>
或者有更好的方法来实现这一点,可以在css文件或其他解决方案中指定媒体?
使用jquery和jquery-ui。
Or is there better way to to this, can media specified in css file or other solution ? jquery and jquery-ui are used.
推荐答案
通常不要发布外部链接,您的问题可以在这里找到 http://danielcorreia.net/blog/quick -start-to-mvc4-bundling /
Normally don't post external links, but a fairly complete solution to your problem can be found here http://danielcorreia.net/blog/quick-start-to-mvc4-bundling/
这篇关于如何添加媒体属性到ASP.NET MVC4样式包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文