小编Jer*_*nam的帖子

IE特定CSS的最佳实践是什么?

我正在研究基于CSS的库,并且遇到了这个问题,因为处理它的最佳方法是什么.

而且我知道我们都有这个问题,因为IE在标准网络方面有一些意想不到的行为.所以我的问题不仅适用于Microsoft Internet Explorer,因为Microsoft Edge中仍然存在一些问题.

是的,我们可以通过检测浏览器和版本使用javascript来处理它.但整个想法是将它带到单个CSS文件.以及它的可能性.

所以使用Microsoft提供的方法或其他css hacks,


为什么不是IE条件评论?

<!--[if lt IE 7]>  <html class="ie ie6"> <![endif]-->
<!--[if IE 7]>     <html class="ie ie7>  <![endif]-->
<!--[if IE 8]>     <html class="ie ie8"> <![endif]-->
<!--[if IE 9]>     <html class="ie ie9"> <![endif]-->
<!--[if gt IE 9]>  <html class="ie">     <![endif]-->
<!--[if !IE]><!--> <html>                <!--<![endif]-->
Run Code Online (Sandbox Code Playgroud)

要么

<!--[if IE]>
    <link rel="stylesheet" type="text/css" href="ie-only.css" />
<![endif]-->
Run Code Online (Sandbox Code Playgroud)

这仅支持IE9,它已经停止支持并最新引入CSS查询.而我个人认为这html有点混乱.因为当我们编写基于CSS的库时,这看起来很难看.


关于旧版本的IE特定CSS黑客和最新版本的IE CSS查询?

/* For IE 8 & Lower css hacks */
.some-class {
   margin-top: 10px\9 …
Run Code Online (Sandbox Code Playgroud)

html css html5 internet-explorer css3

12
推荐指数
1
解决办法
2612
查看次数

css中背景图像的onclick事件?

我在 html 中创建了一个 div,其中创建了一个文本框并为其分配了背景图像,我想为该输入字段的背景图像创建一个 onclick 事件。

document.getElementsByClassName("textboxcss").onclick = function() {
    alert("Hello"); 
};
Run Code Online (Sandbox Code Playgroud)
.textboxcss {
    background-image: url("../images/sub.png");
    background-repeat: no-repeat;
    background-position: right;
    background-position: 8px 13px;
}
Run Code Online (Sandbox Code Playgroud)
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<div>
    <input class="textboxcss" id="default" type="text">
</div>
Run Code Online (Sandbox Code Playgroud)

我看到图像正确...但我无法以这种方式单击。还有其他办法吗?

html javascript css

5
推荐指数
1
解决办法
6249
查看次数

正则表达式匹配一个字符,该字符后面没有其他特定字符

我正在为托架编写CodeMirror扩展。为了定义defineSimpleCodeMode,我需要进行一些模式匹配,并且试图弄清楚如何实现$ subject。

例如

匹配<所有html标签

<body>
Run Code Online (Sandbox Code Playgroud)

并忽略html标签,其后是 <%

<% if %> 
Run Code Online (Sandbox Code Playgroud)

注:我只想要得到的开始<

如果有人可以帮助我,那将是一个很大的帮助。如果您需要更多详细信息,请告诉我。

谢谢!

javascript regex

1
推荐指数
1
解决办法
2151
查看次数

标签 统计

css ×2

html ×2

javascript ×2

css3 ×1

html5 ×1

internet-explorer ×1

regex ×1