You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何用CSS移除商品描述内图片的下边距以缩小图文间距?

Fixing Extra Bottom Margin on Your "Add to Cart" Image

Got it, let's get that annoying extra space between your add-to-cart button image and the text below sorted out. Since you already confirmed removing the bottom margin works via dev tools, here's how to make that change permanent with CSS:

Option 1: Target the specific image class (most precise)

Your image has the unique class wp-image-623, so we can use that to target only this image and not affect others on your site. Add this CSS code:

.wp-image-623 {
  margin-bottom: 0;
}

If the default WordPress styles are overriding this, you can add !important (though it's better to avoid if possible—try without first):

.wp-image-623 {
  margin-bottom: 0 !important;
}

Option 2: Use a more specific selector

If you want to be extra precise (to prevent accidentally styling other images), combine all the classes from your image tag:

.alignnone.size-full.wp-image-623 {
  margin-bottom: 0;
}

Where to add this CSS in WordPress

  1. Go to Appearance > Customize in your WordPress dashboard
  2. Look for the Additional CSS section (usually at the bottom)
  3. Paste the CSS code there and click Publish

That should replicate the fix you saw in the inspector, removing the unwanted space between your button image and the list below.

内容的提问来源于stack exchange,提问作者Dragonknigh

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.25 07:00:50