html:
css:
* {
margin: 0;
padding: 0;
box-sizing: border-box;
user-select: none;
-moz-user-select: none;
}
body {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
color: #3c3c3c;
}
a {
text-decoration: none;
color: #3c3c3c;
}
a:hover {
text-decoration: underline;
color: #f40;
}
.clearfix::after {
content: "";
clear: both;
display: block;
visibility: hidden;
height: 0;
font-size: 0;
}
.icon {
background-image: url(imgs/icons.png);
background-repeat: no-repeat;
}
.carts {
width: 990px;
margin: 10px auto;
/* border: 1px solid #3c3c3c; */
}
.carts .top {
height: 50px;
line-height: 50px;
}
.selected, .carts .top .title {
float: left;
width: 120px;
padding-left: 10px;
}
.selected {
width: 85px;
cursor: pointer;
}
.selected .checkbox {
display: inline-block;
width: 15px;
height: 15px;
line-height: 15px;
background-position: 0 0;
position: relative;
top: 4px;
cursor: pointer;
}
/* i选中的时候的类 修改背景图片的位置 */
.selected .checkbox.active {
background-position: 0 -20px;
}
.carts .top .product {
/* cacl() 计算函数 */
width: calc(100% - 85px - 85px - (120px*3));
}
.carts .top .operate {
width: 85px;
}
.carts .top .selected label {
cursor: pointer;
}
.carts input[type='checkbox'] {
display: none;
}
.shop-icon {
background-position: -20px -105px;
width: 16px;
height: 16px;
display: inline-block;
/* visibility: hidden */
}
.carts .shop_box .shop {
margin-bottom: 20px;
/* border: 1px solid #3c3c3c; */
}
.carts .shop_box .shop-info {
height: 40px;
line-height: 40px;
}
.carts .shop_box .shop-info .selected {
width: 40px;
}
.carts .shop_box .shop-info .shop-name .shop-icon {
display: inline-block;
width: 16px;
height: 16px;
background-position: -20px -105px;
}
.carts .shop_box .shop-info .shop-name span {
margin-left: 15px;
}
.shop .shop-item .item {
background-color: #fff;
border: 1px solid #3c3c3c;
padding: 20px 0;
}
.shop .shop-item .item>div {
float: left;
width: 120px;
padding-left: 10px;
}
.shop .shop-item .item .selected {
width: 30px;
}
.shop .shop-item .item .operator {
width: 85px;
}
.shop .shop-item .item .product {
width: calc(100% - 30px - 85px - (120px*3) - 150px);
}
.shop .shop-item .item .product .img {
float: left;
}
.shop .shop-item .item .product .img img {
width: 80px;
height: 80px;
}
.shop .shop-item .item .product .info {
/* float: right; */
width: 260px;
padding-left: 100px;
}
.shop .shop-item .item .product .info>div {
margin-bottom: 5px;
}
.shop .shop-item .item .spec {
color: #d3cece;
width: 150px;
}
.shop .shop-item .item .count {
font-size: 0;
color: #444;
}
.shop .shop-item .item .count span {
font-size: 12px;
color: #444;
text-align: center;
/* float: left; */
/* margin-right: 5px; */
background-color: lightslategray;
width: 20px;
display: inline-block;
line-height: 20px;
}
.shop .shop-item .item .count span:nth-child(2) {
display: inline-block;
width: 50px;
background-color: transparent;
position: relative;
top: 1px;
}
.shop .shop-item .item .count span input {
text-align: center;
width: 50px;
}
.shop .shop-item .item .amount {
color: red;
}
.shop_footer {
height: 50px;
background-color: lightslategray;
padding: 20px;
}
.shop_footer .selected, .links {
float: left;
}
.shop_footer .sum {
float: right;
position: relative;
top: -20px;
}
.shop_footer .sum span {
margin-right: 2px;
}
.shop_footer .sum span:last-child {
background-color: #f40;
width: 50px;
/* height: 50px; */
display: inline-block;
text-align: center;
line-height: 50px;
}
js: