


html代码如下:
- 夜空中最亮的星 |
- 送别 |
- 没有什么不同 |
css样式代码如下:
.right{
float:right;
}
.right .top{
width:750px;
height:60px;
line-height:60px;
border:2px solid #F66;
margin-bottom:15px;
}
.top ul{
padding-left:15px;
}
.top ul li{
float:left;
width:240px;
margin-bottom:15px;
border:1px solid #3CC;
}
.right .bott{
width:750px;
border:2px dashed #F3C;
padding-top:20px;
}
.bott ul{
margin-bottom:20px;
}
.bott ul li{
float:left;
margin-bottom:20px;
margin-left:20px;
height:220px;
width:220px;
}
.bott ul li img{
width:220px;
height:220px;
}
.footer{
margin:auto 30px;
background:#3F6;
}
.clearfix:after{
content".";
display:block;
height:0px;
clear:both;
visibility:hidden;
显示的结果是我右边部分的框压根就没有框住所有的li。。。图片传不上。。郁闷
回复讨论(解决方案)
图片如下。。红色的部分是我right部分的边框,本来是要套住所有li的哪个图片的。。
我觉得应该是清除浮动的关系,可是我都清浮动了,,为什么还是没有效果呢。。坐等解决啊
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>无标题文档</title><style type="text/css">.right{float:right;}.right .top{width:750px;height:60px;line-height:60px;border:2px solid #F66;margin-bottom:15px;}.top ul{padding-left:15px;}.top ul li{float:left;width:240px;margin-bottom:15px;border:1px solid #3CC;}.bott{float:left;width:750px;border:2px dashed #F3C;}.bott ul{float:left;margin:0;padding:0;list-style:none;background-color:#f00;}.bott li{float:left;margin:0;padding:10px;height:220px;width:220px;background-color:#ddd;}.bott li img{width:220px;height:220px;background-color:#fff;border:1px solid #ccc;display:block;}.footer{margin:auto 30px;background:#3F6;}.clearfix:after{content".";display:block;height:0px;clear:both;visibility:hidden;}</style></head><body><div class="right clearfix"> <div class="top"> <ul class="clearfix"> <li>夜空中最亮的星 |</li> <li>送别 |</li> <li>没有什么不同 |</li> </ul> </div> <div class="bott"> <ul> <li><img src="/static/imghwm/default1.png" data-src="img/1.jpg" class="lazy" alt="tup1"></li> <li><img src="/static/imghwm/default1.png" data-src="img/2.jpg" class="lazy" alt="tup2"></li> <li><img src="/static/imghwm/default1.png" data-src="img/3.jpg" class="lazy" alt="tup3"></li> <li><img src="/static/imghwm/default1.png" data-src="img/4.jpg" class="lazy" alt="tup4"></li> <li><img src="/static/imghwm/default1.png" data-src="img/5.jpg" class="lazy" alt="tup5"></li> <li><img src="/static/imghwm/default1.png" data-src="img/6.jpg" class="lazy" alt="tup6"></li> <li><img src="/static/imghwm/default1.png" data-src="img/7.jpg" class="lazy" alt="tup7"></li> <li><img src="/static/imghwm/default1.png" data-src="img/10.jpg" class="lazy" alt="tup10"></li> <li><img src="/static/imghwm/default1.png" data-src="img/15.jpg" class="lazy" alt="tup15"></li> </ul> </div></div></body></html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>无标题文档</title><style type="text/css">.right{float:right;}.right .top{width:750px;height:60px;line-height:60px;border:2px solid #F66;margin-bottom:15px;}.top ul{padding-left:15px;}.top ul li{float:left;width:240px;margin-bottom:15px;border:1px solid #3CC;}.bott{float:left;width:750px;border:2px dashed #F3C;}.bott ul{float:left;margin:0;padding:0;list-style:none;background-color:#f00;}.bott li{float:left;margin:0;padding:10px;height:220px;width:220px;background-color:#ddd;}.bott li img{width:220px;height:220px;background-color:#fff;border:1px solid #ccc;display:block;}.footer{margin:auto 30px;background:#3F6;}.clearfix:after{content".";display:block;height:0px;clear:both;visibility:hidden;}</style></head><body><div class="right clearfix"> <div class="top"> <ul class="clearfix"> <li>夜空中最亮的星 |</li> <li>送别 |</li> <li>没有什么不同 |</li> </ul> </div> <div class="bott"> <ul> <li><img src="/static/imghwm/default1.png" data-src="img/1.jpg" class="lazy" alt="tup1"></li> <li><img src="/static/imghwm/default1.png" data-src="img/2.jpg" class="lazy" alt="tup2"></li> <li><img src="/static/imghwm/default1.png" data-src="img/3.jpg" class="lazy" alt="tup3"></li> <li><img src="/static/imghwm/default1.png" data-src="img/4.jpg" class="lazy" alt="tup4"></li> <li><img src="/static/imghwm/default1.png" data-src="img/5.jpg" class="lazy" alt="tup5"></li> <li><img src="/static/imghwm/default1.png" data-src="img/6.jpg" class="lazy" alt="tup6"></li> <li><img src="/static/imghwm/default1.png" data-src="img/7.jpg" class="lazy" alt="tup7"></li> <li><img src="/static/imghwm/default1.png" data-src="img/10.jpg" class="lazy" alt="tup10"></li> <li><img src="/static/imghwm/default1.png" data-src="img/15.jpg" class="lazy" alt="tup15"></li> </ul> </div></div></body></html>
我粘贴楼主的代码,显示了li都在right的边框里。。。。仔细看了下代码,没有发现有什么大的变动啊,求赐教。。。
你装个代码比较软件看一看,我改动的css挺多的,删除了元素上的clearfix
你装个代码比较软件看一看,我改动的css挺多的,删除了元素上的clearfix
我试试。。能说下你发现我这代码的主要问题是哪些呢。。clearfix用的地方不对吗
你装个代码比较软件看一看,我改动的css挺多的,删除了元素上的clearfix
我试试。。能说下你发现我这代码的主要问题是哪些呢。。clearfix用的地方不对吗
不要在ul,上用margin,padding
何时用clear:看一看这篇: CSS浮动属性Float详解
何时用clear:看一看这篇: CSS浮动属性Float详解
3q,我去认真看下。。
I have also tried this, no change. .
When you want the child box to float, it is best to set the parent box to float so that they are at the same level, so that the size of the parent box will change accordingly.
.clearfix:after{
content".";
display:block;
height:0px;
clear:both;
visibility:hidden;
It’s you Is the post incomplete, or is this what you wrote?
Let me say two things about this
One is irrelevant }
Two, your content is wrong
content: ".";
I tried it and it worked fine. You can try again.
The code is yours.
No: What editor is yours? I don’t want to highlight such low-level errors.
No: What editor do you have? You don’t even highlight such low-level errors
It’s just me being careless. . I use Dreamweaver
When you want the child box to float, it is best to set the parent box to float so that they are at the same level, so that the size of the parent box will change accordingly,
That makes sense. . . I learned a trick, thank you very much

The function of HTML is to define the structure and content of a web page, and its purpose is to provide a standardized way to display information. 1) HTML organizes various parts of the web page through tags and attributes, such as titles and paragraphs. 2) It supports the separation of content and performance and improves maintenance efficiency. 3) HTML is extensible, allowing custom tags to enhance SEO.

The future trends of HTML are semantics and web components, the future trends of CSS are CSS-in-JS and CSSHoudini, and the future trends of JavaScript are WebAssembly and Serverless. 1. HTML semantics improve accessibility and SEO effects, and Web components improve development efficiency, but attention should be paid to browser compatibility. 2. CSS-in-JS enhances style management flexibility but may increase file size. CSSHoudini allows direct operation of CSS rendering. 3.WebAssembly optimizes browser application performance but has a steep learning curve, and Serverless simplifies development but requires optimization of cold start problems.

The roles of HTML, CSS and JavaScript in web development are: 1. HTML defines the web page structure, 2. CSS controls the web page style, and 3. JavaScript adds dynamic behavior. Together, they build the framework, aesthetics and interactivity of modern websites.

The future of HTML is full of infinite possibilities. 1) New features and standards will include more semantic tags and the popularity of WebComponents. 2) The web design trend will continue to develop towards responsive and accessible design. 3) Performance optimization will improve the user experience through responsive image loading and lazy loading technologies.

The roles of HTML, CSS and JavaScript in web development are: HTML is responsible for content structure, CSS is responsible for style, and JavaScript is responsible for dynamic behavior. 1. HTML defines the web page structure and content through tags to ensure semantics. 2. CSS controls the web page style through selectors and attributes to make it beautiful and easy to read. 3. JavaScript controls web page behavior through scripts to achieve dynamic and interactive functions.

HTMLisnotaprogramminglanguage;itisamarkuplanguage.1)HTMLstructuresandformatswebcontentusingtags.2)ItworkswithCSSforstylingandJavaScriptforinteractivity,enhancingwebdevelopment.

HTML is the cornerstone of building web page structure. 1. HTML defines the content structure and semantics, and uses, etc. tags. 2. Provide semantic markers, such as, etc., to improve SEO effect. 3. To realize user interaction through tags, pay attention to form verification. 4. Use advanced elements such as, combined with JavaScript to achieve dynamic effects. 5. Common errors include unclosed labels and unquoted attribute values, and verification tools are required. 6. Optimization strategies include reducing HTTP requests, compressing HTML, using semantic tags, etc.

HTML is a language used to build web pages, defining web page structure and content through tags and attributes. 1) HTML organizes document structure through tags, such as,. 2) The browser parses HTML to build the DOM and renders the web page. 3) New features of HTML5, such as, enhance multimedia functions. 4) Common errors include unclosed labels and unquoted attribute values. 5) Optimization suggestions include using semantic tags and reducing file size.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Dreamweaver Mac version
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

WebStorm Mac version
Useful JavaScript development tools