如何在asp web应用程序中为每个浏览器使用css? [英] how to use css for each browser in asp web application ?
问题描述
HI ALL
i尝试在我的ASP Web应用程序项目中添加两个CSS,
i想要为IE运行第一个,以及其他浏览器,如Chrome,Firefox等。
我该怎么做?在我的母版页面?
请知道吗?
谢谢:)
确定浏览器类型,然后为这些浏览器添加CSS链接。您可以使用Request.Browser.Browser
确定浏览器。有关请求的详细信息,请参阅。浏览器
[ ^ ]对象请参考MSDN。
@ if(browser == IE){
// 附加Internet Explorer的CSS
} else {
// 为其他浏览器附加CSS
}
有关浏览器功能和获取的详细文档它们在ASP.NET中,请参考此文档: https://msdn.microsoft.com/en-us /library/3yekbd5b.aspx [ ^ ]
另一种方法是使用IE hacks,在注释中添加CSS并仅添加到IE中。但这是一个黑客,所以不要使用它。无论如何,这里是链接。 https://css-tricks.com/how-to-create-an-ie -only-stylesheet / [ ^ ]
HI ALL
i try to add two CSS in my ASP web application project ,
i want to run first one for IE , and other one for Other browsers such as Chrome , firefox etc..
how can i do that ? in my master page ?
please any idea ?
thanks :)
Determine the browser type and then add the CSS links for those browsers. You can determine the browser usingRequest.Browser.Browser
. For more onRequest.Browser
[^] object please refer to MSDN.
@if(browser == "IE") { // Attach the CSS for Internet explorer } else { // Attach the CSS for other browsers }
For detailed documentation about browser capabilities and getting them in ASP.NET, refer to this documentation: https://msdn.microsoft.com/en-us/library/3yekbd5b.aspx[^]
Another way is by using the IE hacks, in which you add the CSS in a comment and is added to the IE only. But that is a hack, so do not use it. Anyways, here is the link for that. https://css-tricks.com/how-to-create-an-ie-only-stylesheet/[^]
这篇关于如何在asp web应用程序中为每个浏览器使用css?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!