2014-01-15 70 views
0

我有一个宽度为1000px,高度为250px的横幅。带边框的图像边框1px:0;没有js

<a href="#"> 
    <img width="1000" height="250" border="0" src="http://oboshto.ru/upme/shits/banner1000.jpg" alt=""> 
</a> 

我无法编辑图像和链接代码。但是我可以在横幅之前和之后添加自定义代码。

如何设置1px的横幅边框?

看看我jsfiddle

我的代码看起来并不好(看下边框和右边框,但旗帜大小是正确的)

回答

1

你的边界是存在的,它的原因不是在右侧和底部是你的容器已width:998px; height:248px;但你的形象有width="1000" height="250"要么增加两个像素的容器内,使图像不打破或设置容器overflow:hidden;

+0

设置没有因为图像是打破在容器,设置'溢出:hidden'将简单地隐藏图像上的高度和宽度的额外2px,并显示边框:[fiddle](http://jsfiddle.net/aNzGM/13/) – jmore009

+0

完美的作品。非常感谢! – oboshto

0

这是代码,我有ç忌用 使用CSS

img { border: 1px solid #fff000; } 

和代码

<div style="width:998px; height:248px;"> 

    <!-- CAN'T EDIT THIS BLOCKS FROM --> 
    <a href="#"> 
     <img width="1000" height="250" border="0" src="http://oboshto.ru/upme/shits/banner1000.jpg" alt=""></img> 
    </a> 
    <!-- TO --> 

</div> <!-- << editable --> 
0

http://jsfiddle.net/5JjQW/检查这个代码,你可以用

<div style="position: absolute;border: 1px solid #f00;width:998px; padding:2px; height:248px;"> 


<a href="#"> 
<img width="1000" height="250" border="0" src="http://oboshto.ru/upme/shits/banner1000.jpg" alt=""></img> 
</a> 


</div>