Table of Contents
回复讨论(解决方案)
Home Web Front-end HTML Tutorial 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

Jun 24, 2016 am 11:52 AM

请问怎么改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>
Copy after login


以下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;}
Copy after login


回复讨论(解决方案)

类似这样的

.right-extra ul li {.....}
Copy after login

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;}
Copy after login

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

Statement of this Website
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What is the purpose of the <datalist> element? What is the purpose of the <datalist> element? Mar 21, 2025 pm 12:33 PM

The article discusses the HTML &lt;datalist&gt; element, which enhances forms by providing autocomplete suggestions, improving user experience and reducing errors.Character count: 159

What is the purpose of the <progress> element? What is the purpose of the <progress> element? Mar 21, 2025 pm 12:34 PM

The article discusses the HTML &lt;progress&gt; element, its purpose, styling, and differences from the &lt;meter&gt; element. The main focus is on using &lt;progress&gt; for task completion and &lt;meter&gt; for stati

What is the purpose of the <meter> element? What is the purpose of the <meter> element? Mar 21, 2025 pm 12:35 PM

The article discusses the HTML &lt;meter&gt; element, used for displaying scalar or fractional values within a range, and its common applications in web development. It differentiates &lt;meter&gt; from &lt;progress&gt; and ex

What is the purpose of the <iframe> tag? What are the security considerations when using it? What is the purpose of the <iframe> tag? What are the security considerations when using it? Mar 20, 2025 pm 06:05 PM

The article discusses the &lt;iframe&gt; tag's purpose in embedding external content into webpages, its common uses, security risks, and alternatives like object tags and APIs.

What is the viewport meta tag? Why is it important for responsive design? What is the viewport meta tag? Why is it important for responsive design? Mar 20, 2025 pm 05:56 PM

The article discusses the viewport meta tag, essential for responsive web design on mobile devices. It explains how proper use ensures optimal content scaling and user interaction, while misuse can lead to design and accessibility issues.

How do I use HTML5 form validation attributes to validate user input? How do I use HTML5 form validation attributes to validate user input? Mar 17, 2025 pm 12:27 PM

The article discusses using HTML5 form validation attributes like required, pattern, min, max, and length limits to validate user input directly in the browser.

What are the best practices for cross-browser compatibility in HTML5? What are the best practices for cross-browser compatibility in HTML5? Mar 17, 2025 pm 12:20 PM

Article discusses best practices for ensuring HTML5 cross-browser compatibility, focusing on feature detection, progressive enhancement, and testing methods.

How do I use the HTML5 <time> element to represent dates and times semantically? How do I use the HTML5 <time> element to represent dates and times semantically? Mar 12, 2025 pm 04:05 PM

This article explains the HTML5 &lt;time&gt; element for semantic date/time representation. It emphasizes the importance of the datetime attribute for machine readability (ISO 8601 format) alongside human-readable text, boosting accessibilit

See all articles