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

语言切换(LTR转RTL)时CSS自定义调整文本对齐问题求助

Fixing RTL Language Alignment Issue on Your Service Page

Hey there! The problem here is that your current CSS forces left-aligned text for the feature boxes, and there's no styling in place to override this when switching to an RTL language. Most language switcher plugins add a dir="rtl" attribute to the <html> tag (or an rtl class to the <body>) when an RTL language is active—we can use that to target the right-aligned styles.

CSS Code to Add

/* Adjust text alignment for RTL mode */
html[dir="rtl"] .widget-features-box.default {
  text-align: right;
}

/* Fix the heading border position for RTL (move it to the right side) */
html[dir="rtl"] .widget-features-box.default .ourservice-heading {
  border-bottom: none;
  border-right: 2px solid #114a82;
  width: auto; /* The original 70% width might not work well for RTL—adjust if needed */
  padding-right: 10px; /* Add a small gap between text and border for better readability */
}

Quick Notes

  • If your plugin adds an rtl class to the <body> instead of the dir attribute on <html>, swap the selector to .rtl .widget-features-box.default instead.
  • The original width: 70% on .ourservice-heading might look odd in RTL layout—feel free to tweak that value or keep width: auto for a more natural flow with right-aligned text.
  • Add this code to your WordPress Customizer's Additional CSS section (under Appearance → Customize) or your child theme's style.css file to make sure changes don't get lost when you update your theme.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.07 10:12:28