Chinaunix首页 | 论坛 | 博客
  • 博客访问: 185381
  • 博文数量: 62
  • 博客积分: 1477
  • 博客等级: 上尉
  • 技术积分: 475
  • 用 户 组: 普通用户
  • 注册时间: 2012-07-11 14:28
文章分类

全部博文(62)

文章存档

2012年(62)

我的朋友

分类: 系统运维

2012-07-18 13:43:41



点击(此处)折叠或打开

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
  2.     <html xmlns="">
  3.     <head>
  4.     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5.     <title>无标题文档</title>
  6.     <style>
  7.     body {background:url(http://www.google.com.hk/intl/zh-CN/images/logo_cn.png) 0 0 repeat;}
  8.     * {margin:0;padding:0;}
  9.     .Boxer {width:600px;height:400px;overflow:hidden;margin:0 auto;border:6px solid red;}
  10.     .Opacity {
  11.             height:400px;
  12.             background-color:rgba(0,0,0,0.5); /*标准浏览器 只需这句*/
  13.             background-color:#000\9; /*IE 系列*/
  14.             filter:alpha(opacity=50); /*IE 系列*/
  15.             /*
  16.                     作为透明背景的层,不可以有 position 属性,不知为何。。。
  17.                     。
  18.                     background-color:rgba(0,0,0,0.5) 这句,IE6貌似能读懂一小部分,我艹了。所以只能将background-color:#000 写在其后,然后加个IE的专有Hack。
  19.                     不信可以写一个试试看
  20.                     background-color:#000;background-color:rgba(0,0,0,0.5);filter:alpha(opacity=50);
  21.                     IE6会让你蛋疼的!
  22.             */
  23.             }
  24.     .BoxerInner {position:relative; /*IE 系列*/
  25.     text-align:center;font-size:24px;font-weight:700;color:yellow;}
  26.     </style>
  27.     </head>
  28.     <body>
  29.     <p style="font-size:60px;color:#000;text-align:center;padding:20px;font-weight:700;">Css:背景色透明,内容不透明之终极方法!兼容,终极。</p>
  30.     <div class="Boxer">
  31.             <div class="Opacity">
  32.                     <div class="BoxerInner">BoxerInner</div>
  33.             </div>
  34.     </div>
  35.     </body>
  36.     </html>

阅读(1392) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~