麻烦老师帮忙看看,是否有改进之处,谢谢
来源:2-7 编程练习
2022一定转行成功
2021-01-22 20:38:52
相关代码:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS布局</title>
<style type="text/css">
/*此处写代码*/
*{
padding:0;margin:0;
}
body{
min-width:880px;
}
h1{
font-family:"宋体";
}
.container{
text-align:center;
}
.container .box{
width:880px;
height:400px;
/*background:purple;*/
margin:0 auto;
}
.container .box .left{
float:left;
width:426px;
}
.container .box .right{
float:right;
width:426px;
}
.container .box dd{
text-align:left;
font-size:18px;
}
</style>
</head>
<body>
<!-- 此处写代码 -->
<div class="container">
<h1>ENJOY THE LIFE</h1>
<div class="box">
<div class="left">
<dl>
<dt>
<img src="http://climg.mukewang.com/58f829090001a4b504260240.jpg"/>
</dt>
<dd>
Life is like a book, just read more and more refined, more write more carefully. When read, mind open, all things have been indifferent to heart. Life is the precipitation.
</dd>
</dl>
</div>
<div class="right">
<dl>
<dt>
<img src="http://climg.mukewang.com/58f8290f0001558804260240.jpg"/>
</dt>
<dd>
Life is like a cup of tea, let people lead a person to endless aftertastes. You again good taste, it will always have a different taste, different people will have different taste more.
</dd>
</dl>
</div>
</div>
</div>
</body>
</html>
1回答
同学你好,文字居中的效果可以添加在h1标签上,这样dd标签就可以不用设置文字居左的样式了,如下:
其他地方实现的不错,祝学习愉快~
相似问题