如何调用基于浏览器的CSS? [英] how to call browser based css?
本文介绍了如何调用基于浏览器的CSS?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我们可以从javascript获取浏览器名称,但是有任何方法来改变CSS相应的。我的意思是一些类的CSS文件,因为我不想链接另一个CSS文件,我想在
写样式
if chrome
a img
{
margin:0;
}
//如果mozila
a img
{
margin:5px;
}
解决方案
/ p>
客户端:您需要使用Javascript来检测浏览器并导入适当的CSS样式。请查看本文。
服务器端:您需要检测用户代理并提供适当的HTML。以下是此 PHP源链接。
we can get the browser name from javascript but is there any way to change css accordingly.I mean some classes of css file because I dont want to link another css file , I want to write styles on
if chrome
a img
{
margin:0;
}
//if mozila
a img
{
margin:5px;
}
解决方案
There are two ways:
Client side: you need to use Javascript to detect the browser and import the appropriate CSS style. Have a look at this article.
Server side: you need to detect the user agent and serve the appropriate HTML. Here's a PHP source link for this.
这篇关于如何调用基于浏览器的CSS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文