2-7 这样对吗 感觉标题没居中
来源:2-7 编程练习
悉尼audrey
2019-11-19 21:08:28
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS布局</title>
<style type="text/css">
*{ margin:0;
padding:0;
}
.container{width:1000px;
height:600px;
margin:0 auto;
}
h3{
text-align:center;
padding-top:30px;
}
p{
text-align:left;
width:426px;
}
.left,
.right{
float:left;
padding:20px;
width:426px;
}
</style>
</head>
<body>
<div class="container">
<h3> ENJOY THE LIFE</h3>
<div class="left">
<img src="http://climg.mukewang.com/58f829090001a4b504260240.jpg">
<p>
As the number of people using the Internet as an integral part of their daily life grows, it is inevitable that the number of Internet Scams will grow. Unfortunately there are many forms of scams but in this article we will look at three of the most prominent.
</p>
</div>
<div class="right">
<img src="http://climg.mukewang.com/58f8290f0001558804260240.jpg">
<p>
As the number of people using the Internet as an integral part of their daily life grows, it is inevitable that the number of Internet Scams will grow. Unfortunately there are many forms of scams but in this article we will look at three of the most prominent.
</P>
</div>
</body>
</html>
1回答
同学你好,代码中的问题如下:
1、如下,.container这个盒子缺少div结束标签,建议:补充下。
2、如下,right这个盒子中的p标签,开始标签是小写,结束标签是大写,这样写也会有效,但是建议:统一小写更加规范。
3、标题是居中了的,但是里面包裹的两个图片单元没有居中。
包裹它们的盒子是居中的,但是如下图,右侧距离盒子的间距有些大,导致整个右边空白比较多,没有实现居中。
建议:可以将外层的大盒子的宽度设置的小一点,一个图片单元占据的宽度是466px(包裹左右的外边距),一行两个,466*2 = 932px;所以外层的大盒子宽度可以设置为932px,例:
如果我的回答帮助了你,欢迎采纳,祝学习愉快~
相似问题