jd首页移动端---使用百分比布局

jd首页移动端—使用百分比布局

// index.css
* {
	margin: 0;
	padding: 0;
}
img {
	vertical-align: middle;
}
li {
	list-style-type: none;
}
a {
	color: #666;
	text-decoration: none;
}
body {
  width: 100%;
	min-width: 320px;
	max-width: 640px;
	margin: 0 auto;
	font-size: 14px;
	color: #666;
	line-height: 1.5;
	font-family: -apple-stystem,Helvetica,sans-serif;
	background-color: #ddd;
	height: 2000px;
}
.app {
	height: 45px;
}
.app ul li {
	float: left;
	height: 45px;
	line-height: 45px;
	text-align: center;
	background-color: #333;
	color: #fff;
}
.app ul li:nth-child(1){
	width: 8%;
	text-align: center;

}
.app ul li:nth-child(1) img {
	width: 10px;
	/* 不写高度的话 等比缩放 */
}
.app ul li:nth-child(2){
	width: 10%;
}
.app ul li:nth-child(2) img {
	width: 30px;
	vertical-align: middle;/* 图片和文字垂直居中对齐,不加的话,图片和文字基线对齐 */
}
.app ul li:nth-child(3){
	width: 57%;
}
.app ul li:nth-child(4){
	width: 25%;
	background-color: red;
}

/*  */
.search-wrap {
	position: fixed;
	overflow:hidden;
	width: 100%;/* 固定定位要有宽度 */
	height: 44px;
	min-width: 320px;
	max-width: 640px;
}
.search-btn {
	position: absolute;
	top: 0;
	left: 0;
	width: 40px;
	height: 44px;
	background-color: rgb(245, 190, 190);
}
.search-btn::before {
	content: '';
	display: block;
	width: 20px;
	height: 18px;
	/* background: url(../img/s-btn.png) no-repeat; 
	background-size: 20px 18px;
	margin: 14px 0 0 15px;
	*/
	
}
.search-login {
	position: absolute;
	right: 0;
	top: 0;
	width: 40px;
	height: 44px;
	line-height: 44px;
	color: #fff;
}
/* 标准流盒子可以缩放 父盒子宽度100% */
.search {
	position: relative;
	height: 30px;
	background-color: #fff;
	margin: 0 50px;
	margin-top: 7px;/* 上边距会发生边距合并,给父级添加overflow:hidden */
	border-radius: 15px;
}
.jd-icon {
	position: absolute;
	top: 8px;
	left: 13px;
	width: 20px;
	height: 15px;
	background-color: rgb(214, 247, 178);
	/* background: url(../img/jd.png) no-repeat; 
	background-size: 20px 15px;
	*/
}
.jd-icon::after {
	position: absolute;
	top: 0;
	right: -8px;
	content: '';
	display: block;
	width: 1px;
	height: 15px;
	background-color: #ccc;
}
.sou {
/* 搜索框中的放大镜,用精灵图 */
/* 二倍精灵图做法:
		在firework里把精灵图等比例缩放为原来的一半,
		根据大小 测量坐标,
		注意background-size也要写:精灵图原来宽度的一半 */
	position: absolute;
	top: 8px;
	left: 50px;
	width: 18px;
	height: 15px;
	background-color: rgb(143, 202, 241);
	/* background: url(../img/jd-sprites.png) no-repeat -81px 0; 
	background-size: 200px;
	*/
}

/* 焦点图 在搜索框下边,所以搜索盒子定位fixed*/
.slider {
	width: 100%;
	/* 高等比缩放 ,因为没有图片,现设置个height*/
	height: 240px;
	background-color: rgb(240, 146, 243);
}
/* 品牌日  */
.brand {
	overflow: hidden;/* 目的是让图片也有圆角 */
	border-radius: 10px 10px 0 0;
}
/* 3个div各占33.33% */
.brand div {
	float: left;
	width: 33.33%;
}
.brand div img {
	width: 100%;
	background-color: rgb(119, 241, 211);
	/* 因为没有图片,现设置个height */
	height: 150px;
}
/*  导航栏  */
nav {
	padding-top: 5px;
}
nav a {
	float: left;
	width: 20%;
	text-align: center;
}
nav a img {
	width: 40px;
	/* 因为没有图片,现设置个height */
	height: 40px;
	margin: 10px 0;
}
nav a span {
	display: block;
	
}
/* 新闻模块 */
.news {
	margin-top: 20px;
}
.news img {
	width: 100%;
	/* 因为没有图片,现设置个height */
	height: 120px;
}
.news a {
	float: left;
	box-sizing: border-box;
}
.news a:nth-child(1) {
	width: 50%;
}
.news a:nth-child(n+2) {
	width: 25%;
	border-left: 1px solid #ccc;
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值