div居中、透明

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

<style type="text/css">
	body
	{
		background-color:black;
		/*background-image:url(guanggao2.jpg);*/
	}
	#div1
	{
		/**div居中**/
		margin:auto;
		border:10px solid silver;
		background-color:#FF9;
		width:300px;
		height:300px;
		opacity:0.50;/**其他浏览器(0.5为透明度,在0-1之间的浮点数)**/
		filter:alpha(opacity=40);/**IE(40为透明度,在0-100之间的整数)**/
	}

</style>

<body>
	<div id="div1">
    	hello world;
    </div>
</body>
</html>

你可能感兴趣的:(div居中、透明)