• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
If She Said "Yes".
What'll you do ?
博客园    首页    新随笔    联系   管理    订阅  订阅
关于hr的各版本浏览器兼容性

  hr标签,相信大家都能熟悉,我们一般用它来产生横线的效果。我们可以对它定义“颜色”、“高度”、“宽度”、“边框”等样式。

  在此只讨论“颜色”和“边框”对于不同版本浏览器的兼容性。

颜色:

  火狐、IE7+=  :通过background-color来指定。

  IE6-=  :通过color指定。

  方案:要为hr指定颜色,同时使用background-color和color。

边框:

  IE7+=  :如不指定border:none,那么浏览器默认会为hr加上一定宽度的边框。

  IE6-=  :浏览器默认不会为其加上边框。

  方案:显示申明border:none。

完整的兼容代码如下:

<style type="text/css">
hr
{
border
:none;
background-color
:#060;
color
:#060;

height
:2px;
width
:80%;
}
</style>
<body>
<h1>
Obama says Warren Buffett is right about taxes
</h1>
<hr/>
<p >
CANNON FALLS, Minnesota (Reuters) - Small-town Americans probably don't make as much money as Warren Buffett, but they pay more of their income in taxes, President Barack Obama said on Monday, citing the billionaire investor to argue that the government needs more revenues to balance the budget.
</p>
</body>

posted on 2011-08-16 17:40  百花盛开  阅读(2561)  评论(1)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3