移动端电商页面制作

203 阅读1分钟

本文已参与「新人创作礼」活动,一起开启掘金创作之路。

第1关:移动端电商页面制作

相关知识

为了完成本关任务,你需要掌握:

1.盒模型
2.overflow属性
选择器{overflow:属性值;}

,

编程要求

根据提示,在右侧编辑器补充

  1. 设置all盒模型中的宽度为346px,高度为578px;
  2. 设置all盒模型中的上下外边距为 20px ,左右自动(auto),居中显示;
  3. 设置all盒模型中的内边距分别为90px 0 0 34px;
  4. 设置content盒模型的宽度为277px,高度为414px;
  5. 设置content盒模型的溢出内容会被修剪,且浏览器会始终显示滚动条的属性值代码。

显示效果图如下:

,

通关代码

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>移动电商页面</title>
<style type="text/css">
/* ********* Begin ********* */
body{ font-size:12px;}   
body,img{padding:0; margin:0; border:0;}  
.all{
	width: 346px;
	height: 578px;
	background:url(https://www.educoder.net/api/attachments/2073417) no-repeat;
	margin: 20px auto;
	padding: 90px 0 0 34px;
}
.content{
    width: 277px;
    height: 414px;
    overflow: scroll;
/* ********* End ********* */
}
</style>
</head>
<body>
<div class="all">
    <div class="content">
        <img src="https://www.educoder.net/api/attachments/2072741" />
    </div>
</div>
</body>
</html>