Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to change negative sign position css

I have a web site that shows its content it two direction. rtl & ltr.

When page is in ltr content mode, every thins is OK and the negative sign shows in the left of number.

body {
    direction: ltr;
}

For example: -1

But when page is in rtl mode,

body {
    direction: rtl;
}

the negative sign of numbers shows in the right of number.

For example: 1-

Whereas I want to show negative sign in the left of number in both cases. How do I do this? Thanks.

like image 711
Tavousi Avatar asked Mar 16 '15 10:03

Tavousi


2 Answers

Wrap the number in span and add two following css to it:

direction: ltr;
display: inline-block;
like image 93
Tavousi Avatar answered Oct 04 '22 03:10

Tavousi


Check the code below!

BODY {
    direction: rtl;
}
#test {
    direction: ltr;   
    text-align: right
}
    Sample Text abc <br />
    -1
    <p id="test">-1 </p>
like image 35
avnaveen Avatar answered Oct 04 '22 02:10

avnaveen