http://bingye07.blog.163.com/blog/#m=0 这个博客很多前端的~
1、访问伪元素里的content属性值
<span style="font-size:18px;">// Get the color value of .element:before
var color = window.getComputedStyle( document.querySelector('.element'), ':before' ).getPropertyValue('color');
// Get the content value of .element:before
var content = window.getComputedStyle( document.querySelector('.element'), ':before' ).getPropertyValue('content');</span>
<span style="font-size:18px;">.disabled { pointer-events: none; }</span>
3、CSS3圆角边框:
-moz-border-radius: 5px; //firefox
-webkit-border-radius:5px; //webkit
border-radius: 5px; //ie9+
如果支持低版本的ie,可以去jquery.org社区通过插件实现,或者用css2的圆角背景图,网上有种方法用javascript(curvycorners.js)在页面加载的时候对ie进行设置
调用方法非常简单,首先我们要去官网下载这个插件
优点:对于非IE的适合CSS3的样式border-radius(或者-moz-border-radius、-webkit-border-radius)直接应用css,ie的通过js处理
4、CSS兼容浏览器
.demo {
-moz-
width
:
980px
;
width
:
900px
;
*
width
:
1000px
}
/*这个对你的2个要求都做了处理。默认是900px,IE6显示1000,FF显示980*/
注意:建议将firefox写在最前面,其他默认的现在中间,最后写ie6(ie6识别*x和_x的属性,其他的浏览器不识别)
5、表格内容自动换行
table {
table-layout: fixed;
word-wrap:break-word;(word-break:break-all这个会将英文单词截成两半,看布局而决定要不要)
}
div {
word-wrap:break-word;
}
5、层或者窗口居中(兼容多个浏览器)
function CalcShowModalDialogLocation(dialogWidth, dialogHeight) {
var iWidth = dialogWidth;
var iHeight = dialogHeight;
var iTop = (window.screen.availHeight - 20 - iHeight) / 2;
var iLeft = (window.screen.availWidth - 10 - iWidth) / 2;
return 'dialogWidth:' + iWidth + 'px;dialogHeight:' + iHeight + 'px;dialogTop: ' + iTop + 'px; dialogLeft: ' + iLeft + 'px;center:yes;scroll:yes;status:yes;resizable:0;location:yes';
}