2014-01-15 75 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>