Home  >  Article  >  Web Front-end  >  Please help me how to modify this css code_html/css_WEB-ITnose

Please help me how to modify this css code_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 11:52:081280browse

请问怎么改CSS让它只对以下html代码起作用,现有的css好像是控制所有ul li的,但我只想控制下面html代码部分

以下html代码

<div class="right-extra" style="margin:100px;">  <!--产品参数开始-->  <div>    <div id="preview" class="spec-preview"> <span class="jqzoom"><img jqimg="images/b1.jpg" src="images/s1.jpg" /></span> </div>    <!--缩图开始-->    <div class="spec-scroll"> <a class="prev">&lt;</a> <a class="next">&gt;</a>      <div class="items">        <ul>          <li><img alt="佳能" bimg="images/b1.jpg" src="images/s1.jpg" onmousemove="preview(this);"></li>          <li><img alt="佳能" bimg="images/b2.jpg" src="images/s2.jpg" onmousemove="preview(this);"></li>          <li><img alt="佳能" bimg="images/b3.jpg" src="images/s3.jpg" onmousemove="preview(this);"></li>          <li><img alt="佳能" bimg="images/b1.jpg" src="images/s1.jpg" onmousemove="preview(this);"></li>          <li><img alt="佳能" bimg="images/b3.jpg" src="images/s3.jpg" onmousemove="preview(this);"></li>          <li><img alt="佳能" bimg="images/b1.jpg" src="images/s1.jpg" onmousemove="preview(this);"></li>          <li><img alt="佳能" bimg="images/b2.jpg" src="images/s2.jpg" onmousemove="preview(this);"></li>          <li><img alt="佳能" bimg="images/b1.jpg" src="images/s1.jpg" onmousemove="preview(this);"></li>          <li><img alt="佳能" bimg="images/b2.jpg" src="images/s2.jpg" onmousemove="preview(this);"></li>          <li><img alt="佳能" bimg="images/b2.jpg" src="images/s2.jpg" onmousemove="preview(this);"></li>          <li><img alt="佳能" bimg="images/b1.jpg" src="images/s1.jpg" onmousemove="preview(this);"></li>          <li><img alt="佳能" bimg="images/b2.jpg" src="images/s2.jpg" onmousemove="preview(this);"></li>        </ul>      </div>    </div>    <!--缩图结束-->  </div>


以下CSS代码
img,ol,ul,li{margin:0;padding:0;}ol, ul{ list-style: none outside none;}.m { margin-bottom: 10px; }.m, .mt, .mc, .mb{ overflow: hidden; }/* Clear Fix */ .clearfix:after{content:".";display:block;height:0;clear:both;visibility:hidden;} .clearfix{display:inline-block;} /* Hide from IE Mac */ .clearfix{display:block;} /* End hide from IE Mac */ /* end of clearfix */ /*页面全局结束*/.tab{ overflow:hidden; }.tab li,.tab a,.tab-item{cursor:pointer;float:left;text-align: center;}.m, .mt, .mc, .mb{overflow:hidden;}.mt .extra{float: right;}.right-extra .mt{height:28px;line-height:28px;padding:0 10px 8px;border-top:1px solid #EED97C;background:url(../images/bg_hotsale.gif) repeat-x 0 -552px;color:#c00;}.right-extra .tab{border-bottom:2px solid #BE0000;margin-bottom:10px;}.right-extra .tab li{position:relative;height:24px;padding:3px 12px 0;background:url(../images/icon_clubs.gif) #ccc no-repeat right -150px;overflow:hidden;margin-right:3px;line-height:24px;font-size:14px;font-weight:bold;color:#c30;}.right-extra .tab span{position:absolute;left:0;top:0;z-index:1;width:10px;height:27px;background:url(../images/icon_clubs.gif) no-repeat 0 -150px;}.right-extra .tab a{float:none;color:#c30;}.right-extra .tab .curr{background-position:right -178px;color:#fff;}.right-extra .tab .curr span{background-position:0 -178px;}.right-extra .tab .curr a{color:#fff;}.right-extra .mc .extra{padding:5px 10px;border-top:1px solid #F3E6C6;}.right-extra .total{float:right;}.right-extra .total strong{color:#FF7403;}.right-extra .total a:link,.right-extra .total a:visited{color:#005aa0;}.right-extra .join a:link,.right-extra .join a:visited{color:#FF7604;}.right-extra .norecode{padding:0 10px 10px;}.right-extra .iloading{margin-bottom:10px;}/*图片放大镜样式*/.jqzoom{float:left;border:none;position:relative;padding:0px;cursor:pointer;margin:0px;display:block;}.zoomdiv{z-index:100;position:absolute;top:0px;left:0px;width:350px;height:350px;background:#ffffff;border:1px solid #CCCCCC;display:none;text-align:center;overflow:hidden;}.jqZoomPup{z-index:10;visibility:hidden;position:absolute;top:0px;left:0px;width:20px;height:20px;border:1px solid #aaa;background:#ffffff /*url(../images/zoom.png) 50% center no-repeat*/;opacity: 0.5;-moz-opacity: 0.5;-khtml-opacity: 0.5;filter: alpha(Opacity=50);}/*图片小图预览列表*/.spec-preview{width:350px;height:350px;border:1px solid #DFDFDF;}.spec-scroll{clear:both;margin-top:5px;width:352px;}.spec-scroll .prev{float:left;margin-right:4px;}.spec-scroll .next{float:right;}.spec-scroll .prev,.spec-scroll .next{display:block;font-family:"宋体";text-align:center;width:10px;height:54px; line-height:54px;border:1px solid #CCC;background:#EBEBEB;cursor:pointer;text-decoration:none;}.spec-scroll .items{float:left;position:relative;width:322px;height:56px;overflow:hidden;}.spec-scroll .items ul{position:absolute;width:999999px;height:56px;}.spec-scroll .items ul li{float:left;width:64px;text-align:center;}.spec-scroll .items ul li img{border:1px solid #CCC;padding:2px;width:50px;height:50px;}.spec-scroll .items ul li img:hover{border:2px solid #FF6600;padding:1px;}


回复讨论(解决方案)

类似这样的

.right-extra ul li {.....}

CSS代码里面的ul、cl就是针对class="items"的呀

.spec-scroll .items ul{position:absolute;width:999999px;height:56px;}.spec-scroll .items ul li{float:left;width:64px;text-align:center;}.spec-scroll .items ul li img{border:1px solid #CCC;padding:2px;width:50px;height:50px;}.spec-scroll .items ul li img:hover{border:2px solid #FF6600;padding:1px;}

这里只是对全局ul、cl初始化
img,ol,ul,li{margin:0;padding:0;} ol, ul{ list-style: none outside none;}

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn