关于media属性

media属性大家都很熟悉,但是如果不注意就很容易混淆是css2的用法还是css3的用法,因为这牵扯到浏览器的兼容性的问题了,所以还是要了解清楚,虽然是基础的东西

1.media type
在css2中定义的, 所以所有主流浏览器支持
例子:
<link rel=”stylesheet” type=”text/css” media=”screen” href=”sans-serif.css”>
<link rel=”stylesheet” type=”text/css” media=”print” href=”serif.css”>
写到css中代码如下:  @media screen { body { font-family: sans-serif } }

type类型:
all
Suitable for all devices.

关于input, button用 line-height垂直居中的测试

今天测试了input[type=text], input[type=button], input[type=submit], button标签的line-height的问题

如果定了line-height:60px; height不定:
1, input[type=text]:
ie7-9, ff , opera 高度撑不开,是适合字体大小的高度
chrome, safari 高度会被line-height撑开,不需要定高度

2, input[type=button], input[type=submit]:
ff , opera 高度撑不开,是适合字体大小的高度
ie7-9,   chrome, safari 高度都会被line-height 撑开,不需要定高度

css hack

1. css属性 hack

* background-color:#00FF00;/* IE6  IE7 */

_ background-color:# 00FFFF;/* IE6 */

color:#0000FF\0; /* IE8,IE9,Opera*/

color:#0000FF\9; /* IE */

2. css选择器 hack

p, x:-moz-any-link {  color: red } /* ff2 ,还有ie7*/
p, x:-moz-any-link, x:default { color: blue } /* ff3及以上, 还有ie7  */

:root #element { color:pink\0; }  /* IE9,Opera */
:root #element { color:pink\0/IE9; }  /* IE9 */

*html #element { color:white; } /* ie6 */

*+html #element { color:white; } /* ie7 */

页面