css完成文本照片竖直垂直居中实际效果

日期:2020-12-12 类型:科技新闻 

关键词:在线网页制作,建网页,个人简介网页制作,简单网页,建立网页


拷贝编码
编码以下:

<!doctype html>
<html>
<head>
<meta charset="utf⑻">
<title>轻轻松松完成:竖直垂直居中文本照片</title>
<!-- START Plugin CSS -->
<style type="text/css">
html{
font-size:12px;
}
.control{
width:600px;
border:1px solid #000;
padding:10px;
margin:0 auto;
}
.main_header{
border:1px solid blue;
height:100px
}
.main_body{
border:1px solid red;
height:500px
}
.main_footer{
border:1px solid #ccc;
height:100px
}
.main_header,.main_body,.main_footer{
margin-bottom:5px;
}
.content{
width:102px;
margin:10px auto;
overflow:hidden;
}
.content .info{
width:100px;
height:200px;
border:1px solid green;
display:table-cell;
vertical-align:middle;
margin:0 auto;
}
.content .fix{
display:inline;
width:0;
height:100%;
vertical-align:middle;
zoom:1; /*开启IE hasLayout*/
}
.content .desc{
display:inline;
width:100%;
vertical-align:middle;
zoom:1; /*开启IE hasLayout*/
}
.content .img{
float:left;
width:100px;
height:100px;
border:1px solid #333;
line-height:100px;
text-align:center;
*font-size:100px; /* IE */
}
.content img{
vertical-align:middle;
}
</style>
<!-- END Plugin CSS -->
</head>
<body>
<div class="control js_control">
<!-- START header -->
<div class="main_header" >
header
</div>
<!-- END header -->
<!-- START body -->
<div class="main_body">
<div class="content">
<div class="info">
<div class="fix"></div>
<div class="desc">
无霜制冷,不但环保节能省电,还免除除霜苦恼。冷藏速率快,食物由内到外匀称冻透,保鲜实际效果好,口感新鮮,更能锁定营养成分不外流。
</div>
</div>
</div>
<div class="content">
<div class="img">
<img src="P0204729753.jpg" width="50" height="50" />
</div>
</div>
</div>
<!-- END body -->
<!-- START footer -->
<div class="main_footer">
footer
</div>
<!-- END footer -->
</div>
<!-- START Plugin JS -->
<script type="text/javascript">
</script>
<!-- END Plugin JS -->
</body>
</html>