@charset "utf-8"; /* 简单reset */ body, ul, li { margin: 0; padding: 0; } body { font: 14px/24px Microsoft YaHei; color: #333; } ul { list-style: none; } a { color: #333; outline: none; text-decoration: none; } a:hover { color: #2986dd; } img { border: none; } .clearfix:after { visibility: hidden; display: block; font-size: 0; content: " "; clear: both; height: 0; } .clear { display: block; clear: both; height: 0; font-size: 0; line-height: 0; content: "."; overflow: hidden; } .wrap { width: 900px; padding-top: 30px; margin: 0 auto; } .boxs { padding: 15px; margin: 0 auto 30px; background-color: #e4fbff; } .box01 { width: 870px; } .box02 { float: left; width: 400px; } .box03 { float: right; width: 400px; } .box04 { width: 720px; } /* 具体样式 ---------- */ /* 通用必需样式 */ /* PS:有些重要样式在js里先写好了,下面id容器、ul和li标签的样式比较重要 */ .autoBox { position: relative; margin: 0 auto; overflow: hidden; } .autoBox ul { position: absolute; list-style: none; z-index: 2; } /* 第一、四个列表 */ /* PS:左右滚动型列表需要css定义高度,li标签可以有margin值 */ #autoScroll01, #autoScroll04 { width: auto; height: 174px; } #autoScroll01 ul li, #autoScroll04 ul li { float: left; width: 128px; height: 168px; padding: 3px; margin: 0 5px; _display: inline; } #autoScroll01 li a, #autoScroll04 li a { display: block; padding: 3px; border: 1px solid #dbdbdb; box-shadow: 0 0 3px rgba(170, 223, 252, 0.5); } #autoScroll01 li a:hover, #autoScroll04 li a:hover { border-color: #71ddff; box-shadow: 0 0 3px rgba(77, 185, 245, .90); } #autoScroll01 li img, #autoScroll04 li img { display: block; width: 120px; height: 160px; } /* 第二、三个列表 */ /* PS:上下滚动型列表需要css定义宽度,li标签尽量不要设置margin值 */ #autoScroll02, #autoScroll03 { width: 100%; height: auto; } #autoScroll02 ul li { height: 30px; line-height: 30px; overflow: hidden; } #autoScroll03 ul li { height: 40px; line-height: 40px; overflow: hidden; } #autoScroll02 li a, #autoScroll03 li a { display: block; width: 100%; height: 24px; line-height: 24px; margin: 3px 0; text-overflow: ellipsis; white-space: nowrap; overflow: hidden; } #autoScroll03 li a { margin: 8px 0; }
js代码如下: