search
HomeWeb Front-endHTML TutorialSomeone help me look at the code_html/css_WEB-ITnose



Someone help me look at the code_html/css_WEB-ITnose



明明图片的边框设的是近白色,怎么右边和底部有一条红线呢。

回复讨论(解决方案)

单独这段代码看是没什么问题的,可能是其它样式影响 a,div产生边框

我就是这段代码直接保存为html的,就有这个问题

红线是你div的背景引起的

我的图片是310PX,加上两边的边框2PX一共是312PX,不是把整个DIV占满了吗,怎么还会有影响呢

我的图片是310PX,加上两边的边框2PX一共是312PX,不是把整个DIV占满了吗,怎么还会有影响呢

你把你的a的display:block去掉



Someone help me look at the code_html/css_WEB-ITnose



你试试

去掉display:block没用。按最下面的只要加上一张图片就还是有这个问题

去掉display:block没用。按最下面的只要加上一张图片就还是有这个问题

我还就不信了。。。
你试下面的代码:

    <div   style="max-width:90%"><a href="http://siteadmin.taobao.com/module/#" target="_blank"><img  src="/static/imghwm/default1.png"  data-src="http://g.hiphotos.baidu.com/album/w%3D2048/sign=4106f3c3d000baa1ba2c40bb7328b812/0e2442a7d933c8950f78a654d01373f08202009e.jpg"  class="lazy"     style="max-width:90%"  alt="Someone help me look at the code_html/css_WEB-ITnose" ></a></div>

和浏览器有关吧?我怎么没看到你说的现象?

你用的什么浏览器?

我试了一下,用火狐没有,用IE和360的都有,这个是什么原因呢

u011523992 你试过吗,我还是不行,用火狐没有,用IE和360的都有。代码改的和你的一样了。



Someone help me look at the code_html/css_WEB-ITnose


你用的IE版本是多少?是不是图片的原因呀

IE10.    我用的是22寸显示器,页面默认放大到150%,有红线。如果改变一下放到到100%,125%,200%都没有红线。用360浏览器也有这个问题。这个是什么缘故呢。

换了图片也是一样

明白了是不是像素的问题,缩放的时候可能算出来像素不是整数,就四舍五入了,就造成偏差了

把图片格式换成png格式的试试,png在放大和缩小的时候是不会失真的

我觉得 是ie的a有个默认的颜色!,你先申明a的颜色行不行看看。。

应该是浏览器的问题,我用chrome和IE8就没有这种问题

改成PNG还是一样的。A的默认颜色不是红色吧




--->

这是什么写法?

xiaowanzi80hou你把页面放大看看,可能放大到某个比例就有问题,再大一点又没问题

你代码写错了,图片大小设定不起作用,默认原大小显示。

原来的:
【width="310px" height="310px"】

改为
【width="310"  style="max-width:90%"】

这样就没问题了。

不是的哦,明显显示的不是310像素

css加入头文件  保证元素边框像素全部清0  有些时候可能是浏览器自身原因,

把所有换行去掉写在一行里面。

怎么试都不行...IE8...就是最底下有个4px左右的红底...只能肯定是背景的...用IE自带的开发人员工具看了硬是说父层有316px的高,而里面明明只有312px,margin padding border都调过还是不行...果然只能用overflow来解决这类情况么?可还是想知道IE处理这些情况的规则...求大牛!

上网搜了一下,虽然没有具体解释(原因),但是其解决方法还是可以用的~下面代码中,第一个是楼主的问题的那种情况,第二个是在img那里加了个display:block;来解决的,第三个是加了vertical-align:top;属性,而最后一个,我自己观察出来的,直接把img的margin给改了 = = 当然,还可以用overflow:hidden; 这种方法应该最简单了吧(勿喷勿喷 = =)
还是希望有人解释一下原理 = =

<div style="height:312px;width:312px;background:#BC0020; float:left;"><a href="http://siteadmin.taobao.com/module/#" target="_blank"><img  src="/static/imghwm/default1.png"  data-src="http://g.hiphotos.baidu.com/album/w%3D2048/sign=4106f3c3d000baa1ba2c40bb7328b812/0e2442a7d933c8950f78a654d01373f08202009e.jpg"  class="lazy"     style="max-width:90%"  alt="Someone help me look at the code_html/css_WEB-ITnose" ></a></div><div style="height:312px;width:312px;background:#BC0020; float:left;"><a href="http://siteadmin.taobao.com/module/#" target="_blank"><img  src="/static/imghwm/default1.png"  data-src="http://g.hiphotos.baidu.com/album/w%3D2048/sign=4106f3c3d000baa1ba2c40bb7328b812/0e2442a7d933c8950f78a654d01373f08202009e.jpg"  class="lazy"     style="max-width:90%"  alt="Someone help me look at the code_html/css_WEB-ITnose" ></a></div><div style="height:312px;width:312px;background:#BC0020; float:left;"><a href="http://siteadmin.taobao.com/module/#" target="_blank"><img  src="/static/imghwm/default1.png"  data-src="http://g.hiphotos.baidu.com/album/w%3D2048/sign=4106f3c3d000baa1ba2c40bb7328b812/0e2442a7d933c8950f78a654d01373f08202009e.jpg"  class="lazy"     style="max-width:90%"  alt="Someone help me look at the code_html/css_WEB-ITnose" ></a></div><div style="height:312px; width:312px; background:#BC0020; float:left;"><a href="http://siteadmin.taobao.com/module/#" target="_blank"><img  src="/static/imghwm/default1.png"  data-src="http://g.hiphotos.baidu.com/album/w%3D2048/sign=4106f3c3d000baa1ba2c40bb7328b812/0e2442a7d933c8950f78a654d01373f08202009e.jpg"  class="lazy"     style="max-width:90%"  alt="Someone help me look at the code_html/css_WEB-ITnose" ></a></div>

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
How can you validate your HTML code?How can you validate your HTML code?Apr 24, 2025 am 12:04 AM

HTML code can be cleaner with online validators, integrated tools and automated processes. 1) Use W3CMarkupValidationService to verify HTML code online. 2) Install and configure HTMLHint extension in VisualStudioCode for real-time verification. 3) Use HTMLTidy to automatically verify and clean HTML files in the construction process.

HTML vs. CSS and JavaScript: Comparing Web TechnologiesHTML vs. CSS and JavaScript: Comparing Web TechnologiesApr 23, 2025 am 12:05 AM

HTML, CSS and JavaScript are the core technologies for building modern web pages: 1. HTML defines the web page structure, 2. CSS is responsible for the appearance of the web page, 3. JavaScript provides web page dynamics and interactivity, and they work together to create a website with a good user experience.

HTML as a Markup Language: Its Function and PurposeHTML as a Markup Language: Its Function and PurposeApr 22, 2025 am 12:02 AM

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 of HTML, CSS, and JavaScript: Web Development TrendsThe Future of HTML, CSS, and JavaScript: Web Development TrendsApr 19, 2025 am 12:02 AM

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.

HTML: The Structure, CSS: The Style, JavaScript: The BehaviorHTML: The Structure, CSS: The Style, JavaScript: The BehaviorApr 18, 2025 am 12:09 AM

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: Evolution and Trends in Web DesignThe Future of HTML: Evolution and Trends in Web DesignApr 17, 2025 am 12:12 AM

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.

HTML vs. CSS vs. JavaScript: A Comparative OverviewHTML vs. CSS vs. JavaScript: A Comparative OverviewApr 16, 2025 am 12:04 AM

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.

HTML: Is It a Programming Language or Something Else?HTML: Is It a Programming Language or Something Else?Apr 15, 2025 am 12:13 AM

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

See all articles

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

Video Face Swap

Video Face Swap

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

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools