I have a div that it's direction is determined by the content it hosts (using dir="auto"
). I would like to use CSS (if it's impossible than javascript) to determine the direction and change the absolute position of the delete span accordingly.
see here in this fiddle: https://jsfiddle.net/psjgsnby/
<div dir="auto" class="item">
text
<span>x</span>
</div>
<div dir="auto" class="item">
מימין לשמאל
<span>x</span>
</div>
css:
.item {
position: relative;
width: 200px;
}
.item span {
position: absolute;
right: 0;
top: 0;
}
i'm looking for something like this selector:
.item span:dir(rtl) {
right: auto;
left: 0;
}
but something that works cross-browser (the above works only for firefox)