如何在asp web应用程序中为每个浏览器使用css? [英] how to use css for each browser in asp web application ?

查看:75
本文介绍了如何在asp web应用程序中为每个浏览器使用css?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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 using Request.Browser.Browser. For more on Request.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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆