Html Css跨浏览器代码
我正在使用mozilla、chrome和edge作为主要资源创建我的网站,以查看它是否动态运行良好 但是当我打开IE浏览器时,我的css,比如“transforms”,所有的格式都是奇怪的,它们最初在IE中的位置已经不一样了 有没有一种方法可以让css对每个浏览器进行选择或限制,比如在chrome上使用“transform”,然后在IE上使用“right”Html Css跨浏览器代码,html,css,wordpress,Html,Css,Wordpress,我正在使用mozilla、chrome和edge作为主要资源创建我的网站,以查看它是否动态运行良好 但是当我打开IE浏览器时,我的css,比如“transforms”,所有的格式都是奇怪的,它们最初在IE中的位置已经不一样了 有没有一种方法可以让css对每个浏览器进行选择或限制,比如在chrome上使用“transform”,然后在IE上使用“right” 我不能在chrome上使用“right”,否则会被取消格式化,所以,我想知道是否有特殊条件 对浏览器规范使用以下技巧 google chro
我不能在chrome上使用“right”,否则会被取消格式化,所以,我想知道是否有特殊条件 对浏览器规范使用以下技巧
google chrome:
@media screen and (-webkit-min-device-pixel-ratio:0)
{
#element { properties:value; }
}
firefox:
@-moz-document url-prefix() {
#element { properties:value; }
}
Opera:
@media all and (-webkit-min-device-pixel-ratio:10000), not all and (-webkit-min-device-pixel-ratio:0) {
#element { properties:value; }
}
safari:
@media screen and (-webkit-min-device-pixel-ratio:0) {
#element { properties:value; }
}
Internet Explorer 9 and lower :
<!--[if IE]>
<link rel="stylesheet" type="text/css" href="all-ie-only.css" />
<![endif]-->
Internet Explorer 10 & 11 :
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
/* IE10+ CSS styles go here */
}
Microsoft Edge 12 :
@supports (-ms-accelerator:true) {
/* IE Edge 12+ CSS styles go here */
}
googlechrome:
@媒体屏幕和(-webkit最小设备像素比:0)
{
#元素{properties:value;}
}
火狐:
@-moz文档url-前缀(){
#元素{properties:value;}
}
歌剧:
@媒体全部和(-webkit最小设备像素比:10000)、非全部和(-webkit最小设备像素比:0){
#元素{properties:value;}
}
游猎:
@媒体屏幕和(-webkit最小设备像素比:0){
#元素{properties:value;}
}
Internet Explorer 9及更低版本:
Internet Explorer 10和11:
@介质全部和(-ms高对比度:无),(-ms高对比度:激活){
/*IE10+CSS样式在这里*/
}
Microsoft Edge 12:
@支持(-ms加速器:true){
/*IE Edge 12+CSS样式在此处使用*/
}
有关未来的详细信息和规范,请参见以下链接&使用以下浏览器规范的技巧
google chrome:
@media screen and (-webkit-min-device-pixel-ratio:0)
{
#element { properties:value; }
}
firefox:
@-moz-document url-prefix() {
#element { properties:value; }
}
Opera:
@media all and (-webkit-min-device-pixel-ratio:10000), not all and (-webkit-min-device-pixel-ratio:0) {
#element { properties:value; }
}
safari:
@media screen and (-webkit-min-device-pixel-ratio:0) {
#element { properties:value; }
}
Internet Explorer 9 and lower :
<!--[if IE]>
<link rel="stylesheet" type="text/css" href="all-ie-only.css" />
<![endif]-->
Internet Explorer 10 & 11 :
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
/* IE10+ CSS styles go here */
}
Microsoft Edge 12 :
@supports (-ms-accelerator:true) {
/* IE Edge 12+ CSS styles go here */
}
googlechrome:
@媒体屏幕和(-webkit最小设备像素比:0)
{
#元素{properties:value;}
}
火狐:
@-moz文档url-前缀(){
#元素{properties:value;}
}
歌剧:
@媒体全部和(-webkit最小设备像素比:10000)、非全部和(-webkit最小设备像素比:0){
#元素{properties:value;}
}
游猎:
@媒体屏幕和(-webkit最小设备像素比:0){
#元素{properties:value;}
}
Internet Explorer 9及更低版本:
Internet Explorer 10和11:
@介质全部和(-ms高对比度:无),(-ms高对比度:激活){
/*IE10+CSS样式在这里*/
}
Microsoft Edge 12:
@支持(-ms加速器:true){
/*IE Edge 12+CSS样式在此处使用*/
}
有关未来的详细信息和规范,请参见以下链接&在编写CSS或JS时,您需要检查浏览器兼容性表中所使用的功能。您可以在官方资源网站(如 特别是对于变换,请查看:
您需要使用兼容所有希望支持的浏览器的功能(考虑到它们的版本),或者,正如您所提到的,通过检测用户浏览器中的可用功能来编写替代代码。像这样的工具可以帮助您实现这一点。在编写CSS或JS时,您需要检查浏览器兼容性表中所使用的功能。您可以在官方资源网站(如 特别是对于变换,请查看: 您需要使用兼容所有希望支持的浏览器的功能(考虑到它们的版本),或者,正如您所提到的,通过检测用户浏览器中的可用功能来编写替代代码。像这样的工具可以帮助实现这一点