HTML+CSS实现淘宝首页(二)https://developer.aliyun.com/article/1382561
CSS部分源代码如下:
* { padding: 0; margin: 0; list-style: none; text-decoration: none; } html, body { width: 100%; height: 100%; background-color: #f4f4f4; color: #3c3c3c; overflow-x: hidden; /*横向滚动条隐藏*/ } .wrapper { width: 100%; height: 100%; } /*上导航条,加阿里88会员节的背景长高度*/ .wrapper .top-nav-wrap { width: 100%; height: 121px; } .wrapper .top-nav-wrap .top-nav { width: 1190px; height: 35px; margin: 0 auto;/*外边距*/ } .wrapper .top-nav-wrap .top-nav .top-nav-l { float: left; } .wrapper .top-nav-wrap .top-nav .top-nav-r { float: right; } .wrapper .top-nav-wrap .top-nav ul li { float: left; margin-right: 7px;/*右外边距*/ } .wrapper .top-nav-wrap .top-nav a { color: #6c6c6c; font-size: 12px;/*字体大小*/ line-height: 35px;/*文字上下居中*/ padding: 0 6px;/*内边框*/ } .wrapper .top-nav-wrap .top-nav a:hover { color: #f40; } .wrapper .top-nav-wrap .top-nav .china { color: #3c3c3c; line-height: 35px;/*文字上下居中*/ font-size: 13px;/*字体大小*/ } .wrapper .top-nav-wrap .top-nav .bg-pic { display: inline-block; width: 6px; height: 3px; background-size: 100% 100%;/*图片不平浮*/ vertical-align: middle; /*垂直排列中间对齐*/ } .wrapper .top-nav-wrap .top-nav .c-span { padding: 0 6px; } .wrapper .top-nav-wrap .top-nav .bg-pic.xsj-pic { background-image: url('./img/xsj.png'); } .wrapper .top-nav-wrap .top-nav .bg-pic.shopCar-pic { background-image: url(./img/gwc.png); width: 12px; height: 12px; } .wrapper .top-nav-wrap .top-nav .bg-pic.like-pic { background-image: url(./img/star.png); width: 12px; height: 12px; } .wrapper .top-nav-wrap .top-nav .bg-pic.web-nav-pic { background-image: url(./img/dh.png); width: 8px; height: 7px; } .wrapper .top-nav-wrap .top-nav .cut-off span{ line-height: 39px;/*颜色*/ color: #ddd;/*颜色*/ } /*地址中国大陆下面 阿里88会员节背景颜色*/ .wrapper .top-nav-wrap .ad-wrap {/*地址中国大陆下面*/ width: 100%;/*宽*/ height: 86px;/*高*/ background-color: #613621;/*颜色*/ } .wrapper .top-nav-wrap .ad-wrap .ad { height: 80px; width: 80px; padding: 10px 10px 10px 15px; } /*阿里88会员节图片设置宽高等样式*/ .wrapper .top-nav-wrap .ad-wrap img { margin-left: 54px; position: relative; top: -10px; display: inline-block; width: 1148px; height: 79px; background-size: 100% 100%; } /*搜素区域**/ .wrapper .search-wrap { width: 100%; height: 97px; padding-top: -4px; background-color: #613621; } /*搜索框背景与高款*/ .wrapper .search-wrap .search-con { position: relative; width: 1190px; height: 97px; margin: 0 auto; background-color: #fff } /*阿里88会员节长高样式*/ .wrapper .search-wrap .search-con .logo-box { position: relative; /*相对定位*/ top: -0px; /*自身向上移动10px*/ display: inline-block; /*准线对齐*/ width: 190px; height: 97px; background-image: url('动态图.gif'); /*动态小图*/ background-size: 100% 100%; } .wrapper .search-wrap .search-con .search-box { display: inline-block; /*准线对齐*/ width: 627px; height: 87px; vertical-align: top; margin-left: 50px; } .wrapper .search-wrap .search-con .search-box .search-t { width: 627px; height: 62px; } .wrapper .search-wrap .search-con .search-box .search-t .search-tab { height: 22px; margin-left: 17px; } .wrapper .search-wrap .search-con .search-box .search-t .search-tab ul li { float: left; /*左浮动*/ width: 36px;/*字体大小*/ height: 22px; color: #f40; font-size: 12px; line-height: 22px;/*文字上下居中*/ text-align: center; margin-right: 4px; border-top-right-radius: 6px; /*右圆角*/ border-top-left-radius:6px;/*左圆角*/ } .wrapper .search-wrap .search-con .search-box .search-t .search-tab ul li.select { color: #fff; font-weight: 700; /*字体加粗*/ background: linear-gradient(to right, #ff9000 0, #ff5000 100%); } .wrapper .search-wrap .search-con .search-box .search-t .search-tab ul li:hover { background-color: #ffeee5; } .wrapper .search-wrap .search-con .search-box .search-t .search-panel { width: 627px; height: 40px; position: relative; } .wrapper .search-wrap .search-con .search-box .search-t .search-panel form { } .wrapper .search-wrap .search-con .search-box .search-t .search-panel form .btn { width: 74px; height: 40px; position: absolute; top: 0; right: 0; border-top-right-radius: 20px; border-bottom-right-radius: 20px; overflow: hidden; border: none; } .wrapper .search-wrap .search-con .search-box .search-t .search-panel form .btn button { width: 100%; height: 100%; background: linear-gradient(to right, #ff9000 0, #ff5000 100%);/*css3线性渐变*/ border: none; color: #fff; font-weight: 700; font-size: 18px; cursor: pointer; /*鼠标放上有小手显示*/ } .wrapper .search-wrap .search-con .search-box .search-t .search-panel .search-inp-box { width: 551px; height: 36px; border: 2px solid #ff5000; border-top-left-radius: 20px; border-bottom-left-radius: 20px; overflow: hidden; } .wrapper .search-wrap .search-con .search-box .search-t .search-panel .search-inp { width: 551px; height: 36px; overflow: hidden; } .wrapper .search-wrap .search-con .search-box .search-t .search-panel .search-inp input { width: 551px; height: 24px; padding: 6px 33px; border: none; outline: 0; text-indent: 10px; } .wrapper .search-wrap .search-con .search-box .sousuo, .wrapper .search-wrap .search-con .search-box .camera { display: inline-block; position: absolute; } .wrapper .search-wrap .search-con .search-box .sousuo { width: 12px; height: 14px; top: 11px; left: 14px; background-image: url('./img/fdj.png'); background-size: 100% 100%; } .wrapper .search-wrap .search-con .search-box .camera { width: 20px; height: 22px; top: 11px; right: 90px; background-image: url('./img/camera.png'); background-size: 100% 100%; } .wrapper .search-wrap .search-con .search-box .search-bl { width: 627px; height: 20px; } .wrapper .search-wrap .search-con .search-box .search-bl a{ font-size: 12px; margin-right:8px; color: #666; } .wrapper .search-wrap .search-con .search-box .search-bl a.active, .wrapper .search-wrap .search-con .search-box .search-bl a:hover { color: #ff5000; } .wrapper .search-wrap .search-con .code-box { display: inline-block; width: 76px; height: 90px; border: 1px solid #eee; vertical-align: top; margin-left: 120px; position: relative; } .wrapper .search-wrap .search-con .code-box .phone { color: #ff5000; font-size: 14px; line-height: 20px; margin-left: 6px; } .wrapper .search-wrap .search-con .code-box .code { display: inline-block; width: 62px; height: 62px; background: url('./img/ewm.png') no-repeat; background-size: 100% 100%; margin-left: 6px; } .wrapper .search-wrap .search-con .code-box .close { width: 16px; height: 16px; text-align: center; line-height: 16px; /*垂直居中*/ position: absolute; display: inline-block; top: 0; left: -18px; border: 1px solid #eee; color: : #ddd; font-size: 14px; } /*搜索下的导航条*/ .wrapper .screen-nav { width: 1190px; height: 30px; background: linear-gradient(to right, #ff9000 0, #ff5000 100%); margin: 0 auto; /*实现左右居中*/ } .wrapper .screen-nav .screen-nav-con { width: 100%; height: 100%; } .wrapper .screen-nav .screen-nav-con h2 { float: left; color: #fff; font-size: 16px; width: 190px; height: 100%; background-color: #ff5000; text-align: center; line-height: 30px; } .wrapper .screen-nav .screen-nav-con ul { float: left; } .wrapper .screen-nav .screen-nav-con ul li { float: left; margin:0 3px; padding: 0 4px; position: relative; } .wrapper .screen-nav .screen-nav-con ul li a { line-height: 30px; color: #fff; font-weight: 700; } .wrapper .screen-nav .screen-nav-con ul li:hover::before { content: ""; display: block; width: 30px; height: 30px; background: url('./img/up.png') no-repeat; background-size: center; position: absolute; top: -10px; left: 50%; margin-left: -15px; } /*主要 * * 展示内容*/ .wrapper .screen-box { width: 1190px; height: 632px; margin: 0 auto; /*实现左右居中*/ } .wrapper .screen-box .main { float: left; width: 890px; height: 632px; } .wrapper .screen-box .main .main-inner { width: 890px; height: 522px; } .wrapper .screen-box .main .main-inner .inner-left { float: left; width: 190px; height: 522px; border: 1px solid #f40; background-color: #fff; border-top: none; } .wrapper .screen-box .main .main-inner .inner-left ul li { width: 145px; height: 32px; padding-left: 25px; padding-right: 19px; position: relative; } .wrapper .screen-box .main .main-inner .inner-left ul li a { font-size: 14px; font-weight: 400; color: #666; line-height: 32px; } .wrapper .screen-box .main .main-inner .inner-left ul li span { display: inline-block; width: 5px; height: 8px; position: absolute; right: 10px; top: 50%; margin-top: -4px; background-image: url('./img/yjt.png'); background-size: 100% 100%; } .wrapper .screen-box .main .main-inner .inner-left ul li:hover { background-color: #ffe4dc; } .wrapper .screen-box .main .main-inner .inner-left ul li:hover a{ color: #ff5000; } /*中间轮播图位置*/ .wrapper .screen-box .main .main-inner .inner-content { float: left; width: 520px; height: 522px; } /*轮播图*/ .wrapper .screen-box .main .main-inner .inner-content .pic-box { padding: 8px; .content{width:525px; margin-right:10px;} .content #ad{width:524px; height:190px; position:relative;} .content #pic1{ position:absolute; top:0px; left:0px;} } .wrapper .screen-box .main .main-inner .inner-content .inner-mall { width: 520px; height: 230px; padding: 0 8px; } .wrapper .screen-box .main .main-inner .inner-content .inner-mall .tm { font-size: 12px; color: #666; } .wrapper .screen-box .main .main-inner .inner-right { float: left; padding: 8px; width: 160px; height: 522px; } .wrapper .screen-box .main .main-inner .inner-right .hot { font-size: 12px; margin-top: 11px; } .wrapper .screen-box .main .main-bottom { width: 890px; height: 100px; } /*最下淘宝头条*/ .wrapper .screen-box .main .main-bottom .content { background-color: #fff; padding: 14px 12px; margin-top: 10px; position: relative; height: 61px; } .wrapper .screen-box .main .main-bottom .content .logo-box { width: 180px; height: 73px; background-image: url('./img/tbtt.png'); background-size: 100% 100%; } .wrapper .screen-box .main .main-bottom .content a { position: absolute; top: 14px; left: 200px; } .wrapper .screen-box .main .main-bottom .content a img { float: left; } .wrapper .screen-box .main .main-bottom .content a h4 { margin-top: 2px; margin-left: 144px; color: #333; line-height: 28px; font-size: 16px; height: 28px; } .wrapper .screen-box .main .main-bottom .content a h4:hover { color: #ff5000; } .wrapper .screen-box .main .main-bottom .content a p { margin-left: 144px; color: #999; height: 36px; overflow: hidden; line-height: 14px; margin-top: 3px; } /*右侧部分*/ .wrapper .screen-box .col-right { float: left; width: 290px; height: 632px; } /*中间分类加轮播图高宽等*/ .wrapper .screen-box .col-right .member { width: 290px; height: 134px; background-image: url('./img/bg.png'); background-size: 100% 100%; margin-top: 10px; } .wrapper .screen-box .col-right .member .member-head { width: 290px; height: 91px; } .wrapper .screen-box .col-right .member .member-head .head { width: 290px; height: 56px; text-align: center; } .wrapper .screen-box .col-right .member .member-head .info { display: block; width: 290px; height: 17px; color: #3c3c3c; font-size: 14px; line-height: 17px; text-align: center; } .wrapper .screen-box .col-right .member .member-head .head a { display: inline-block; width: 50px; height: 50px; border-radius: 50%; background-image: url('./img/tx.jpg'); background-size: 100% 100%; } .wrapper .screen-box .col-right .member .member-head p { width: 290px; height: 17px; text-align: center; line-height: 17px; } .wrapper .screen-box .col-right .member .member-head p a { display: inline-block; width: 72px; height: 17px; border-radius: 9px; background-color: #ffe4db; font-size: 12px; color: #ff5000; padding: 0 29px; position: relative; } .wrapper .screen-box .col-right .member .member-head p a span { position: absolute; display: inline-block; width: 16px; height: 16px; top: 0; left: 10px; } .wrapper .screen-box .col-right .member .member-head p a.icon span { background-image: url('./img/pics.png'); background-position: 0 -572.5px; /*调整图片位置*/ } .wrapper .screen-box .col-right .member .member-head p a.club span { background-image: url('./img/pics.png'); background-position: 0 -528px; } .wrapper .screen-box .col-right .member .member-foot { width: 290px; height: 40px; text-align: center;; padding-top: 10px; } .wrapper .screen-box .col-right .member .member-foot a { display: inline-block; height: 25px; width: 75px; background: linear-gradient(to right, #ff5000 0, #ff6f06 100%); border-radius: 4px; text-align: center; line-height: 25px; font-size: 14px; color: #fff; font-weight: 700; } .wrapper .screen-box .col-right .member .member-foot a.login { width: 92px; } .wrapper .screen-box .col-right .message { width: 290px; height: 26px; } .wrapper .screen-box .col-right .message a { display: inline-block; width: 100%; height: 100%; background-color: #ffe4dd; color: #f40; font-size: 12px; text-align: center; line-height: 26px; position: relative; } .wrapper .screen-box .col-right .message a span { display: inline-block; width: 10px; height: 10px; position: absolute; top: 9px; right: 52px; background-image: url('./img/ysj.png'); background-size: 100% 100%; } .wrapper .screen-box .col-right .notice { height: 98px; width: 100%; padding-top: 10px; } .wrapper .screen-box .col-right .notice ul li { float: left; } .wrapper .screen-box .col-right .notice .title { height: 24px; width: 100%; padding: 0 8px; /*box-sizing: border-box;*/ /*css3, 将当前标准模式下盒模型转换成IE模式下的盒模型*/ } .wrapper .screen-box .col-right .notice .title li { width: 32px; height: 20px; margin: 0 11px; text-align: center; } .wrapper .screen-box .col-right .notice .title li a { color: #3c3c3c; font-size: 13px; line-height: 20px; padding: 0 2px; } .wrapper .screen-box .col-right .notice .title li a.active { font-weight: 700; border-bottom: 2px solid #f40; } .wrapper .screen-box .col-right .notice .title li a:hover, .wrapper .screen-box .col-right .notice .content li a.active, .wrapper .screen-box .col-right .notice .content li a:hover { color: #f40; } .wrapper .screen-box .col-right .notice .content { width: 100%; height: 50px; padding: 9px; /*box-sizing: border-box;*/ /*css3, 将当前标准模式下盒模型转换成IE模式下的盒模型*/ } .wrapper .screen-box .col-right .notice .content li { width: 130px; height: 25px; line-height: 25px; text-align: center; } .wrapper .screen-box .col-right .notice .content li a { font-size: 12px; color: #3c3c3c; } .wrapper .screen-box .col-right .module { width: 100%; height: 230px; } .wrapper .screen-box .col-right .module ul li { float: left; width: 72px; height: 75px; border: 1px solid #eee; box-sizing: border-box; /*css3, 将当前标准模式下盒模型转换成IE模式下的盒模型*/ } .wrapper .screen-box .col-right .module ul li:hover { border: 1px solid #f40; } .wrapper .screen-box .col-right .module ul li a { display: block; text-align: center; margin-top: 10px; } .wrapper .screen-box .col-right .module ul li a span { display: inline-block; width: 24px; height: 24px; background: url('./img/pics.png'); } .wrapper .screen-box .col-right .module ul li a p { color: #333; font-size: 12px; } .wrapper .screen-box .col-right .module ul li a span.icon1{ background-position: 0 0; } .wrapper .screen-box .col-right .module ul li a span.icon2{ background-position: 0 -88; } /*阿里APP*/ .ali{ font-size: 14px; height: 30px; line-height: 30px; position: relative; z-index: 2; } .many{ position: absolute; right: 10px; font-size: 12px; font-weight: 400; } .zt{ height: 25px; } .tp{ height:91px; } .goods-list a h4 { margin-top: 5px; font-size: 16px; height: 28px; overflow: hidden; line-height: 28px; font-weight: normal; color: #000 } .111:hover div{ width:700px; height:700px; border:1px solid red ; }