亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

CSS層透明實現(xiàn)方法

  發(fā)布時間:2015-05-13 16:29:12   作者:佚名   我要評論
這篇文章主要為大家介紹了CSS層透明實現(xiàn)方法,涉及filter:alpha屬性的使用技巧,非常簡單實用,需要的朋友可以參考下

本文實例講述了CSS層透明實現(xiàn)方法。分享給大家供大家參考。具體分析如下:

這個代碼段是演示用CSS控制一個DIV層的透明效果,大家可以看到平鋪的背景已經(jīng)顯現(xiàn)出來,實際上比較簡單就可以實現(xiàn),就是用CSS控制一個DIV層,定義樣式表時加入filter:alpha(opacity=65);這句代碼,里面的值是用來控制透明度的,你可以試著改變它的值,會有不同的透明效果。


復(fù)制代碼
代碼如下:

<!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=utf-8" />
<title>CSS定義層的透明效果</title>
<style type="text/css">
body {
font-family: Arial, Helvetica, sans-serif;
line-height: 1.5;
background: url(//img.jbzj.com/file_images/article/201505/2015513164008952.jpg);
color: #fff;
width: 770px;
margin: 0 auto;
padding: 50px;
}
h1,h2 {
color: #77AFC7 !important;
margin-bottom: 0;
line-height: 1.2em;
}
p {
margin-top: 0;
}
a {
color: #aaa;
}
a:hover {
color: #FFF !important;
text-decoration: none;
}
code {
background-color: #100;
padding: 0.2em 0.5em;
display: inline-block;
}
#wrapper {
overflow: hidden;
}
.overlay {
position: absolute;
top: 0;
bottom: 0;
left: 0;
width: 100%;
background: #000;
opacity: 0.65;
-moz-opacity: 0.65;
filter:alpha(opacity=65);
}
.container {
position: relative;
float: left;
}
.content {
position: relative;
float: left;
}
#column-1 {
width: 500px;
}
#column-2 {
width: 250px;
margin-left: 20px;
float: left;
display: inline;
}
#column-1 .content {
padding: 20px;
width: 460px;
}
#column-2 .content {
padding: 10px;
width: 230px;
}
* html #column-1 .overlay { height: expression(document.getElementById("column-1").offsetHeight); }
* html #column-2 .overlay { height: expression(document.getElementById("column-2").offsetHeight); }
</style>
</head>
<body>
<div id="wrapper">
<div id="column-1" class="container">
<div class="overlay"></div>
<div class="content">
<h2>透明的網(wǎng)頁.</h2>
<p>IE6,FF測試通過</p>
<p>這是一個透明的網(wǎng)頁,還不錯吧?實際上是用CSS控制DIV層的半透明狀態(tài),這樣會使平鋪的背景顯現(xiàn)出來,看上去酷了不少。</p>
<p>By <a href="/">CC-Public Domain</a></p>
</div>
</div>
<div id="column-2" class="container">
<div class="overlay"></div>
<div class="content">
<h2>A sidebar</h2>
<p>這是右側(cè),你可以嘗試修改一下。</p>
</div>
</div>
</div>
</body>
</html>

希望本文所述對大家的div+css網(wǎng)頁設(shè)計有所幫助。

相關(guān)文章

最新評論