css3 iphone玻璃透明气泡完美实现

所属分类: 网页制作 / CSS 阅读数: 912
收藏 0 赞 0 分享
效果图如下:

源码如下:

复制代码
代码如下:

<!doctype html>
<html>
<head>
<meta content="text/html;charset=utf-8" http-equiv="content-type" />
<link rel="stylesheet" href="bubble.css" />
<link rel="stylesheet" href="css.css" />
</head>
<body>
<div id="wraper1">
<div style="height:20px;" ></div>
<div style="text-align: left;padding-left:20px">
<div class="bubble">
<div class="content">
广发银行珠海分行原行长:公款花销是为了银行营销自2002年至2010年,广发银行珠海分行党委书记、行长屈建国贪污受贿共3200余万元,最终被判以死刑,缓期两年执行。
</div>
</div>
</div>
</div>
<div id="wraper2">
<div style="text-align: right;padding-right:20px;">
<div class="bubble">
<div class="content"> 经法院审理查明,从2010年12月至2011年2月,屈建国以一些活动的名义,制作签报并提取现金人民币450万元。在发放上述奖金过程中,采用签写签收数额远远超过实发数额的“阴阳条”形式,实际发放人民币303万元,将其中的人民币147万元截留并据为己有。
</div>
</div>
</div>
</div>
<div id="wraper3">
<div style="text-align: left;padding-left:20px">
<div class="bubble">
<div class="content">
珠海烟草局原局长:贪贿500多万 为情人买车买房
</div>
</div>
</div>
</div>
<div id="wraper4">
<div style="text-align: right;padding-right:20px;">
<div class="bubble">
<div class="content">
同时,屈建国还不断找其他机会侵吞公款用于个人及家庭开销。他攻读某名牌大学EM BA花费人民币20万;为自己和家人购买奢侈品、享受高档消费报销,购买“15年茅台”、“30年茅台”等高档酒用掉人民币41.88万元,购买四只“劳力士”和四只“帝舵”手表共花去人民币33.98万元,在某国际会所办理家庭会籍挥霍人民币7.89万元,为女儿屈某归还信用卡消费账款共计人民币6.998万元;等等。
</div>
</div>
</div>
</div>
</body>
</html>

bubble.css:

复制代码
代码如下:

#wraper1,
#wraper2,
#wraper3,
#wraper4 {
color: #000;
position: relative;
width: 100%;
background: #dbe2ed;
}
.bubble {
position: relative;
display: inline-block;
min-width: 30px;
max-width: 300px;
word-break: break-all;
word-wrap: break-word;
min-height: 22px;
background: #d2d2d2;
border-radius: 15px;
margin-bottom: 20px;
padding: 6px 8px;
-webkit-box-shadow: 0px 1px 2px #000, inset 0px 4px 4px rgba(0,0,0,.3), inset 0px -4px 4px rgba(255,255,255,.5);
-moz-shadow: 0px 1px 2px #000, inset 0px 4px 4px rgba(0,0,0,.3), inset 0px -4px 4px rgba(255,255,255,.5);
box-shadow: 0px 1px 2px #000, inset 0px 4px 4px rgba(0,0,0,.3), inset 0px -4px 4px rgba(255,255,255,.5);
}
.bubble:before {
content: '';
display: block;
font-size: 0;
width: 0;
height: 0;
border-width: 6px;
position: absolute;
bottom: -12px;
left: 12px;
border-color: #4a4c50 transparent transparent #4a4c50;
border-style: solid dashed dashed solid;
}
.bubble:after {
content: '';
display: block;
font-size: 0;
position: absolute;
bottom: -9px;
left: 13px;
width: 0;
height: 0;
border-width: 5px;
border-color: #e8e8e8 transparent transparent #e8e8e8;
border-style: solid dashed dashed solid;
}
.bubble .content {
position: relative;
padding: 0 4px;
}
.bubble .content:before {
content: '';
position: absolute;
margin: auto;
top: -5px;
left: 0;
width: 100%;
height: 12px;
background-image: -webkit-linear-gradient(top, rgba(255,255,255,1) 0%, rgba(255,255,255,0.2) 90%, rgba(255,255,255,0) 90% );
background-image: -moz-linear-gradient(top, rgba(255,255,255,1) 0%, rgba(255,255,255,0.2) 90%, rgba(255,255,255,0) 90% );
border-radius: 10px
}
/**
* 绿色气泡
*/
#wraper2 .bubble {
background: #b7da2b;
}
#wraper2 .bubble:before {
left: auto;
right: 12px;
border-color: #4a4c50 #4a4c50 transparent transparent;
border-style: solid solid dashed dashed;
}
#wraper2 .bubble:after {
left: auto;
right: 13px;
border-color: #daec93 #daec93 transparent transparent;
border-style: solid solid dashed dashed;
}
/**
* 橙色气泡
*/
#wraper3 .bubble {
background: #f6d031;
}
#wraper3 .bubble:after {
border-color: #fae796 transparent transparent #fae796;
border-style: solid dashed dashed solid;
}
/**
* 黄色气泡
*/
#wraper4 .bubble {
background: #feed24;
}
#wraper4 .bubble:before {
left: auto;
right: 12px;
border-color: #4a4c50 #4a4c50 transparent transparent;
border-style: solid solid dashed dashed;
}
#wraper4 .bubble:after {
left: auto;
right: 13px;
border-color: #fef690 #fef690 transparent transparent;
border-style: solid solid dashed dashed;
}

css.css:

复制代码
代码如下:

body {
width: 980px;
margin: 0 auto;
font-family: "微软雅黑";
color: #7d7d7d;
}
img {
border: 0;
}
h1, h2 {
text-align: center;
position: relative;
}
h1 {
color: #0092d3;
}
h2 {
color: #53bde8;
}
h3, h4, h5, h6 {
margin: 0;
}
ul, ol, li {
margin: 0;
padding: 0;
text-align: left;
vertical-align: top;
}
li * {
vertical-align: middle;
}
a {
color: #7d7d7d;
}
a:hover {
color: #000;
}
.indent {
margin-left: 2em;
}
.footer {
text-align: right;
font-size: 12px;
}
h1 img {
vertical-align: middle;
}
.code {
margin-left: 2em;
background-color: #aaa;
border-radius: 5px;
padding: 5px;
font-size: 14px;
color: #fff;
}
更多精彩内容其他人还在看

CSS入门教程:计算CSS盒模型宽和高

 出处:当我们布局一个网页的时候,经常会遇到这样的一种情况,那就是最终网页成型的宽度或是高度会超出我们预先的计算,其实就就是所谓的CSS的盒模型造成的。 #test{margin:10px;padding:10px;width:100px;height:100px;}
收藏 0 赞 0 分享

在IE流览器中正确显示PNG透明图片

  png图片有很好的品质。阴影效果也不会有杂边,很流畅。如果插入网页的话可以给网站内容增色不少!更重要的是在不增加图片容量大小的情况下提高了页面的图片的质量。对于有复杂背景,如:在有颜色过度背景上插入不规则边框的图片带来极大很便利!   但目前IE中对于插入
收藏 0 赞 0 分享

CSS教程:DIV底部放置文字

  css对文字的布局上没有靠容器底部对齐的参数,目前使用的一个不错的方法也比较好.就是用position属性来解决,看下面的代码,用position的相对和绝对定位功能也轻松的实现了,文字靠近div低部对齐,并且靠近的距离还可以精确到像素,自己可以调节,是不是很不错呢?
收藏 0 赞 0 分享

如何用CSS让文字居于div的底部

  这个问题是别人提出的,因为css对文字的布局上没有靠容器底部对齐的参数,(或许有但是我没有发现)不过目前我使用的一个不错的方法也比较好.就是用position属性来解决,看下面的代码,我用position的相对和绝对定位功能也轻松的实现了,文字靠近div低部对齐,并且靠近
收藏 0 赞 0 分享

从A页面连接到B页面后并直接把B页面的隐藏层显示

  这个效果实现的是,在B页面里有两个层,一个显示层,我们暂定名c层,一个是隐藏层,我们暂定名d层,单独进B页面的时候,c层显示,d层隐藏,然而从A页面连接到B页面的时候,则是让d层显示,c层隐藏,我觉得这个效果对网页设计者以后会有很大帮助,现在把代码发出来,
收藏 0 赞 0 分享

CSS样式表定义标签li前面样式

定义LI前面的小点样式 view plaincopy to clipboardprint? 语法: list-style-type : disc | circle | square | decimal | lower-roman | upper-roman | lowe
收藏 0 赞 0 分享

符合标准的div css制作的弹出菜单

本文介绍了五款符合标准的div css制作的弹出菜单,而且不含有js的. NO.1最基本的:二级dropdown弹出菜单 <!DOCTYPE html PUB
收藏 0 赞 0 分享

CSS实现在文章每段后面加入带连接的隐藏文字

代码主要理解3个参数:createElement、createTextNode、appendChild。这3个js参数分别是创建元素、创建字符、追加节点。代码原理:循环页面段落标签<p>,创建连接元素<a>,创建要显示的连接字符,用SetAttribute
收藏 0 赞 0 分享

CSS:浏览器特定选择器介绍

当你想在一个浏览器里改变样式而不像在其他浏览器中改变时,这些选择器很有用。 IE6以下 *html{} IE 7 以下 *:first-child html {} * html {} 只对IE 7 *:first-child html {} 只对IE 7
收藏 0 赞 0 分享

WEB标准学习,认识两种网页声明的含义

即网页标准推出来以后,我们时常会看到两种不同的网页的声明,一个是Dhtml,一个是Xhtml。如下所示: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "ht
收藏 0 赞 0 分享
查看更多