[英]Shifting the border-left to border-right CSS
Hi I have a CSS code with the following style property. 嗨,我有一个CSS代码,带有以下style属性。
.spotlight{
border-left: 21px solid #ffb80d;
}
I need to move the spotlight to right for RTL changes.I need to add a change like 我需要将聚光灯移到右侧以进行RTL更改。我需要添加一个更改,例如
.locale-right-to-left .spotlight {
border-right: 21px solid #ffb80d;
}
But if I make this change there will be 2 spotlights on both sides of the text. 但是,如果我进行此更改,则文本的两边都会有两个聚光灯。 Is there a way where I can ignore the border-left property ? 有没有办法可以忽略border-left属性?
.locale-right-to-left .spotlight {
border-right: 21px solid #ffb80d;
border-left: 0;
}
Define border-left 0 定义左边框0
.locale-right-to-left .spotlight
{
border-right: 21px solid #ffb80d;
border-left: 0;
}
If you use : 如果您使用:
element {
direction:rtl;
}
then draw your border from a pseudo-element: 然后从伪元素绘制边框:
element {
direction:rtl;
}
element .spotlight{
position:relative;
}
element .spotlight:before {
position:absolute;
left:auto; /* no need*/
right:auto; /* no need*/
top:0;
bottom:0;
border-left: 21px solid #ffb80d;/* or border-right */
}
The position of :before will relay on direction :before的位置将在方向上中继
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.