如何用CSS移除商品描述内图片的下边距以缩小图文间距?
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
- Go to Appearance > Customize in your WordPress dashboard
- Look for the Additional CSS section (usually at the bottom)
- 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

