Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
站点:在这里
图片html:
<img alt="" src="UserFiles/Image/galerie/12970854473D-Eco-60.jpg">
当我添加border: 2px solid black;到图像时
border: 2px solid black;
布局中断...
我能看到的唯一直接解决您问题的方法是
outline: 2px solid black
这是布局中性的。但是,它在 IE < 8 中不起作用。
作为记录,另一种选择:
border: 2px solid black; margin:-2px;
首先向所有边添加 2px,然后以负边距将它们拉回。
您可以使用 CSS Clip,并在剪切的图像周围应用边框;
我尝试使用边距:-2px,但它对我不起作用。
警告,CSS 剪辑非常反直觉,虽然它与边距和填充有相似的简写,但与边距或填充相比,它的像素值分配截然不同。
这里有一些有用的链接;
涵盖大纲和负边距修复 http://css-tricks.com/2368-image-rollover-borders-that-do-not-change-layout/
CSS 剪辑 http://www.seifi.org/css/creating-thumbnails-using-the-css-clip-property.html