/* 首页容器 */ .container { padding: 10px; } /* 轮播图样式 */ .swiper { width: 100%; height: 200px; /* 根据实际需求调整高度 */ margin: 20px; } .slide-image { width: 100%; height: 100%; border-radius: 10px; /* 圆角 */ } /* 商品分类Tab栏样式 */ .tabs { display: flex; width: 100%; flex-wrap: nowrap; background-color: #f8f8f8; border-radius: 5px; height: 40px; margin: 0 0 10px 0; } .tab { text-align: center; width: 100%; height: 100%; line-height: 40px; font-size: 14px; color: #333; cursor: pointer; border-radius: 5px; } .tab.active { color: #ff5722; border-bottom: 2px solid #ff5722; } /* 商品列表样式 */ .product-list { width: 100%; display: flex; flex-wrap: wrap; justify-content: space-between; } .product-column { width: 48%; /* 两列布局,留出间隙 */ box-sizing: border-box; margin-bottom: 20px; } .product-item { width: 100%; border-radius: 10px; /* 圆角 */ overflow: hidden; box-shadow: 0 4px 8px rgba(0,0,0,0.1); background-color: #fff; } .product-image { width: 100%; height: 40vmin; object-fit: cover; } .product-info { padding: 15px; display: flex; flex-wrap: wrap; flex-flow: column; } .product-name { font-size: 16px; color: #333; margin-bottom: 10px; white-space: nowrap; /* 防止名称换行 */ overflow: hidden; /* 隐藏溢出的文本 */ text-overflow: ellipsis; /* 显示省略号 */ } .product-price { font-size: 15px; color: #f00; } .contain { height: 100%; width: 100%; display: flex; flex-wrap: nowrap; justify-content: space-between; align-items: center; } /* 定义一个圆形按钮的样式 */ .addcar { text-align: center; line-height: 30px; width: 30px; /* 按钮宽度 */ height: 30px; /* 按钮高度 */ background-color: #ffffff; /* 按钮背景颜色 */ border-radius: 10px; /* 圆角为50%,使其成为圆形 */ color: rgb(255, 255, 255); /* 文字颜色 */ font-size: 16px; /* 文字大小 */ box-shadow: 0 0px 10px 1px rgba(0, 0, 0, 0.2); /* 按钮阴影 */ } /* 按钮点击时的样式 */ .addcar:active { background-color: #c9c9c9; /* 点击时的背景颜色 */ } .tocar { position: fixed; bottom: 12vh; right: 7vmin; width: 50px; height: 50px; text-align: center; line-height: 50px; background-color: #ffffff; /* 按钮背景颜色 */ border-radius: 50%; /* 圆角为50%,使其成为圆形 */ color: rgb(255, 0, 0); /* 文字颜色 */ font-size: 20px; /* 文字大小 */ box-shadow: 0 0px 10px 1px rgba(0, 0, 0, 0.2); /* 按钮阴影 */ } .tocar:active { background-color: #c9c9c9; /* 点击时的背景颜色 */ }