[英]Ignoring the property from a CSS class
Hi I am trying to implement RTL in my website. 嗨,我正在尝试在我的网站中实施RTL。 I have a check box like this in CSS
我在CSS中有一个复选框
.labeled-checkbox .checkbox {
position: absolute;
top: 0px;
right: 0px;
margin-top: -1px;
}
In case of RTL language a class will be added dynamically to the html file and a new style will be added to CSS as below. 如果使用RTL语言,则会将一个类动态添加到html文件,并将一种新样式添加到CSS,如下所示。
.locale-right-to-left .labeled-checkbox .checkbox {
position: absolute;
top: 0px;
left: 0px;
margin-top: -1px;
}
Now in this case check box should be moved to the left most direction . 现在,在这种情况下,应将复选框移到最左侧。 But its not happening as both the left and right property are added to the check box.
但是不会发生,因为将left和right属性都添加到了复选框。 Is there any way we can ignore the right:0px and only left:0px can be used in case of RTL languages?
在RTL语言的情况下,有什么方法可以忽略右:0px,而只能使用左:0px?
Add right: auto;
添加
right: auto;
to your RTL class 到您的RTL类
.locale-right-to-left .labeled-checkbox .checkbox {
position: absolute;
top: 0px;
left: 0px;
right: auto;
margin-top: -1px;
}
Use right: auto
in your .locale-right-to-left .labeled-checkbox .checkbox
styles to override the right
rule 使用
right: auto
使用.locale-right-to-left .labeled-checkbox .checkbox
样式覆盖right
规则
https://developer.mozilla.org/en-US/docs/Web/CSS/right https://developer.mozilla.org/en-US/docs/Web/CSS/right
If you add a css class dynamically, you can also remove one. 如果动态添加css类,则也可以删除一个。 So add a class
locale-left-to-right
as default so then you can write the following: 因此,默认添加一个
locale-left-to-right
类,这样您就可以编写以下内容:
.locale-left-to-right .labeled-checkbox .checkbox {
position: absolute;
top: 0px;
right: 0px;
margin-top: -1px;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.