Home  >  Article  >  Web Front-end  >  Example analysis of how to set div background transparent style with CSS

Example analysis of how to set div background transparent style with CSS

黄舟
黄舟Original
2017-07-20 10:24:311770browse

pBackground transparent style:

Style code:

.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;}

Usage:

<p class=”alert”>
背景透明
</p>

html code:

<!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>

The above is the detailed content of Example analysis of how to set div background transparent style with CSS. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn