function css(a) {
var sheets = document.styleSheets, o = {};
for (var i in sheets) {
var rules = sheets[i].rules || sheets[i].cssRules;
for (var r in rules) {
if (a.is(rules[r].selectorText)) {
o = $.extend(o, css2json(rules[r].style), css2json(a.attr('style')));
}
}
}
return o;
}
tr:nth-child(even) { background-color: #000000; }
以上方法不适用于IE8及以下版本。
也可用通过jQuery的方法实现:
$(document).ready(function() {
$("tr:even").css("background-color", "#000000");
});
简单的tooltip:
<div title="This is my tooltip">
复杂的tooltip参考:http://www.designer-daily.com/jquery-prototype-mootool-tooltips-12632
function css(a) {
var sheets = document.styleSheets, o = {};
for (var i in sheets) {
var rules = sheets[i].rules || sheets[i].cssRules;
for (var r in rules) {
if (a.is(rules[r].selectorText)) {
o = $.extend(o, css2json(rules[r].style), css2json(a.attr('style')));
}
}
}
return o;
}
div {
width: 100%;
width: -webkit-calc(100% - 50px);
width: -moz-calc(100% - 50px);
width: calc(100% - 50px);
}
pre {
white-space: pre-wrap; /* CSS 3 */
white-space: -moz-pre-wrap; /* Mozilla, since 1999 */
white-space: -pre-wrap; /* Opera 4-6 */
white-space: -o-pre-wrap; /* Opera 7 */
word-wrap: break-word; /* Internet Explorer 5.5+ */
}
.boxsizingBorder {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
#box {
height: 90px;
line-height: 90px;
}
background-size: 50% 50%;
不过不是所有浏览器都支持的。
热门内容
最新内容
- 3 天 18 小时 ago
- 1 周 1 天 ago
- 1 周 3 天 ago
- 2 周 ago
- 2 周 2 天 ago
- 3 周 3 天 ago
- 3 周 5 天 ago
- 3 周 6 天 ago
- 1个月 ago
- 1个月 1 周 ago
最新评论