2013-06-12 144 views
0

出於某種原因,在this頁面上,圖像沒有整齊地放置在矩形內部;相反,它們在IE,Chrome和Firefox中略微向右移動。圖像定位不正確

<img height="350" width="150" class="product_image" id="product_image_<?php echo wpsc_the_product_id(); ?>" alt="<?php echo wpsc_the_product_title(); ?>" src="<?php echo wpsc_the_product_thumbnail(); ?>" /> 

我設置圖像的高度爲350,寬度均爲150。 「矩形」本身就是

<div class="item_image"> 
         <a href="<?php echo wpsc_the_product_permalink(); ?>"> <!--IMG HERE--></a></div> 

我使用的WP電子商務網格視圖精簡版插件與WP電子商務(其他WordPress插件)。

回答

0

問題出在116行的索引文件(http://yadress.com/make-it-yourself/)上。在錨點選擇器上。

.product_grid_display .item_image a { 
    width: 350px 
} 

從該錨上移除width屬性可解決該問題。

+0

謝謝,這工作,但現在我無法在圖像高度上進行調整,即使我在標記中加入了「height =」350「' –

0

您有3個選擇

  1. 失真以適應幀(DIV),那麼差圖像

    .product_grid_display .item_image一個{ 寬度:350像素; height:150px; }

  2. 創建一個固定大小的幀,以及overfollow屬性:隱藏

    .item_image {寬度:像素;高度:150像素; overfollow:隱藏;} item_image IMG {widht:100%}

  3. 使用timthumb到裁剪圖片適合幀。(建議,這是最好的方式,也有利於頁面速度) 本網站使用timthumb,你可以參考this網站