首頁 > web前端 > css教學 > 主體

CSS如何設定div背景透明樣式的實例分析

黄舟
發布: 2017-07-20 10:24:31
原創
1748 人瀏覽過

p背景透明樣式:

樣式程式碼:

.alert{filter:alpha(opacity=100); /* IE */ -moz-opacity:1.0; /* Moz + FF */
opacity: 1.0; height:300px; width:500px; background:#ccc; left:50%; 
top:50%;margin-top:-150px;margin-left:-250px;position:absolute;z-index:99; 
text-align:center; padding:20px;}
登入後複製

使用方法:

<p class=”alert”>
背景透明
</p>
登入後複製

html程式碼:

<!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></title>
<style type="text/css">
.alert
{filter:alpha(opacity=100); /* IE */ -moz-opacity:1.0; /* Moz + FF */ opacity: 1.0; height:300px; width:500px; background:#ccc; left:50%; 
top:50%;margin-top:-150px;margin-left:
-250px;position:absolute;z-index:99; text-align:center; padding:20px}
</style>
</head>
<body>
<p class="alert"><a href="http://www.100sucai.com">www.100sucai.com</a></p>
</body>
</html>
登入後複製

以上是CSS如何設定div背景透明樣式的實例分析的詳細內容。更多資訊請關注PHP中文網其他相關文章!

相關標籤:
來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!