网页设计中,怎么用CSS做出磨砂的背景效果?

html-css011

网页设计中,怎么用CSS做出磨砂的背景效果?,第1张

代码:透明背景(带磨砂玻璃效果)  注:在粘贴到空白模板前一定先打个空格。

<STYLE type=text/css>

.bodytop{background:#transparent}

.banner{ background:#transparent}

.menu{ background:#transparent}

.bodyBg {background:#transparentfilter:progid:DXImageTransform.Microsoft.gradient(GradientType ='1',enabled='true',startColorstr=#AAFFFFFF, endColorstr=#AAFFFFFF)}

.zone{ background:#transparent}

.bodyBottom{background:#transparent}

.feeds .up{background:#transparent}

.feeds .down{background:#transparent }

.feeds .function{background:#transparent}

.feeds .page{background:#transparent}

.aList .sysHand .up{background:#transparent}

.aList .sysHand .down{background:#transparent}

.gbook .sysHand .up{background:#transparent}

.gbook .sysHand .down{background:#transparent}

.gbook .title{display:none}

.logo{display:none}

.gbook .page{background:#transparent }

.gbook .login{background:#transparent}

.box_1{background:#transparent}

.box_2{background:#transparent}

.calendar{background:#transparent}

.calendar .mid{background:#transparent}

.calendar .top{background:#transparent}

.calendar .title{background:#transparent}

.calendar .bold td{background:#transparent}

.calendar .bottom{background:#transparent}

.callboard .mid{background:#transparent}

.callboard .mid img{background:#transparent}

.callboard .front{background:#transparent}

.callboard .back{background:#transparent}

.callboard table{background:#transparent}

.callboard .up{background:#transparent}

.callboard .down{background:#transparent }

.sysBr{background:#transparent}

.sysBr210{background:#transparent}

.label{background:#transparent}

.label .mid{background:#transparent}

.label .top{background:#transparent}

.label .bottom{background:#transparent}

.photo{background:#transparent}

.photo .mid{background:#transparent}

.photo .image{background:#transparent}

.photo .top{background:#transparent}

.photo .bottom{background:#transparent}

.links{background:#transparent}

.links .up{background:#transparent}

.links .down{background:#transparent }

.links .mid{background:#transparent}

body{background:url("

http://s11.sinaimg.cn/orignal/439175a380fda7635072a

") repeat fixed!important}

.add{background:#transparent}

.add .ico{background:#transparent}

</STYLE>

教你如何制作具有立体感效果的我们详细的解释与说明CSS代码,看它是如何控制这个UL LI打造CSS横向菜单的:* {font-size:12px text-align:center}#nav {width:520px border-bottom:1px solid #06f margin:20px auto 0 auto}#nav li {display: inline list-style-type: none}#nav li a:link,#nav li a:visited {float:left margin-right:5px padding:5px 10px 5px 8px text-decoration: none color:#000 background:#ffe67d border-left: 5px solid #fc0}#nav li a:hover {color:#060 border-left: 5px solid #f60}首先我们进行了整体布局声明,声明了文字大小及居中的对齐方式。需要说明的是,在ff中,我们设置margin:0 auto。即可实现容器的居中了,但在IE中,这还不够,还需要在父容器中声明text-align:center。这一点我们要记得,不然容易出错。声明UL无序列表的宽度为520ox,下边框一象素的实现,颜色为#06f。我们设置了nav这个UL,距离顶部为20px、距离底部为零,左右的距离为auto。这就实现了nav在水平方向内是居中的,垂直方面上距离浏览器窗口20px。声明LI列表项为内联(行内)显示,列表预设标记为无。我们重点需要理解#nav li a:link,#nav li a:visited的定义,设置链接的样式。向左浮动,并且右边距为5px。这是设置链接元素从左向右排行,并且元素之间的右部间隔5px。设置填充,顶5px、右10px、下5px、左8px。这一设置可以使我们的链接文字处于合适的位置。取消链接文字的下划线,并设置链接文字的颜色为#000。链接元素的背景色为#ffe67d。左边框五象素的实线,颜色为#fc0。这一句话形成了我们的小竖条。我们通过下面#nav li a:hover形成鼠标激活的样式。链接文字的颜色变为#060。左边框五象素的实线,颜色为#f60。这样我们会动的小竖条菜单就制作完成了。看最终的代码:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/htmlcharset=gb2312" /><title>免费模板</title><style type="text/css">* {font-size:12px text-align:center}#nav {width:520px border-bottom:1px solid #06f margin:20px auto 0 auto}#nav li {display: inline list-style-type: none}#nav li a:link,#nav li a:visited {float:left margin-right:5px padding:5px 10px 5px 8px text-decoration: none color:#000 background:#ffe67d border-left: 5px solid #fc0}#nav li a:hover {color:#060 border-left: 5px solid #f60}</style></head><body><ul id="nav"> <li><a href="#">图象设计</a></li> <li><a href="#">网站运营</a></li> <li><a href="#">网络编程</a></li> <li><a href="#">创业指南</a></li> <li><a href="#">网站欣赏</a></li></ul></body></html>

页面背景颜色渐变可以分为四个部分

一、从上往下渐变:

body{

FILTER: progid:DXImageTransform.Microsoft.Gradient(gradientType=0,startColorStr=#ffffff,endColorStr=#000000)

}

二、从左上至右下渐变:

body{

FILTER: Alpha( style=1,opacity=25,finishOpacity=100,

startX=50,finishX= 100,startY=50,finishY=100)

background-color: skyblue

}

三、从左往右渐变:

body{

FILTER: progid:DXImageTransform.Microsoft.Gradient(gradientType=1,startColorStr=#ffffff,endColorStr=#000000)

}

四、从上往下渐变:

style="filter:progid:DXImageTransform.microsoft.gradient(gradienttype=0,startColorStr=blue,endColorStr=white)"

下面是整合的完整格式:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html charset=gb2312" />

<title>背景渐变</title>

<style type="text/css">

<!--

body {

margin-left: 0px

margin-top: 0px

margin-right: 0px

margin-bottom: 0px

}

-->

</style></head>

<body>

<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">

<tr>

<td height="600" style="filter:progid:DXImageTransform.microsoft.gradient(gradienttype=0,startColorStr=blue,endColorStr=white)">&nbsp</td>

</tr>

</table>

</body>

</html>

如果是在同一个页面里面显示多重渐变效果,可以定义每个渐变的width和height。