下面是我想要的
这是我的 CSS 代码:
<html>
<header>
<style type="text/css">
*{margin:0 0 0 0;padding:0 0 0 0}
div.block{width:400px;height:121px;border:1px solid red;position:absolute;top:50%;left:50%;}
div.box{float:left;}
div img{margin:0px;padding:0;width:121px;height:121px;float:left;}
div.description{float:left;border 1px solid red;margin:10px 50px;}
</style>
</header>
<body>
<div class="block">
<div class="box"><img src="test.jpg" /></div>
<div class="description">
<p>music mane: xxxxxxxx</p>
<p>author: yyyyyyyy</p>
<p>publication:20081001</p>
<p>language:english</p>
</div>
</div>
</body>
</html>
这是test.img。
div在屏幕右下角,如何让它在屏幕中心?top:50%;left:50%;
取不到结果。
试试这个
用这段代码替换“div.block”
div.block {
width: 400px;
height: 121px;
border: 1px solid red;
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
margin: auto;
}
我是一名优秀的程序员,十分优秀!