码迷,mamicode.com
首页 > Web开发 > 详细

CSS---解决浏览器兼容性

时间:2016-06-09 22:17:14      阅读:215      评论:0      收藏:0      [点我收藏+]

标签:

<html>
<head>
    <title></title>
    <style type="text/css">
        *{
            padding: 0;
            margin:0;
        }
        .line{
            display: inline-block;
            width: 40px;
            border-top: 1px solid #f00;
            vertical-align: middle;
            *margin-top: 12px;
        }
        .txt{
            font-size: 24px;
            margin: 0 26px;
        }
    </style>
</head>
<body>
    <p>
        <i class="line"></i><span class="txt">this is a span.</span><i class="line"></i>
    </p>
</body>
</html>

注:像Firefox等现代浏览器可使用vertical-align属性。而IE6、IE7不识别vertical-align属性,故设置*margin-top:12px,加*的属性是专门给IE6、IE7使用的。这样即解决浏览器兼容性的问题了。

CSS---解决浏览器兼容性

标签:

原文地址:http://www.cnblogs.com/beast-king/p/5572748.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!