语言切换(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
rtlclass to the<body>instead of thedirattribute on<html>, swap the selector to.rtl .widget-features-box.defaultinstead. - The original
width: 70%on.ourservice-headingmight look odd in RTL layout—feel free to tweak that value or keepwidth: autofor 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.cssfile to make sure changes don't get lost when you update your theme.
内容的提问来源于stack exchange,提问作者Diana Taha
相关产品推荐
相关产品推荐

