To the right

I have to be dead. I get damn exact alignment of numbers in the input field.

.number {
     text-align: right;
}

<input name="price" type="text" class="number" />

has no effect.

I need to use an input field, as I refer to the value in JavaScript, and I use it for both input and display.

thanks

+3
source share
3 answers

You might have a more specific selector that overrides a property text-align .number

To make your selector more specific, specify the element type ...

input.number {
   text-align: right;
}

You may need to get more specific information, for example ...

#formId input.number { }
+5
source

Yes - it text-align: rightshould work.

Are you sure that there is no other style or something that redefines it?

( , FireBug Firefox: "Inspect Element" - , , .)

+3

If you still can't get this class to override styles that go elsewhere, you can also try

text-align: right! important;

+2
source

Source: https://habr.com/ru/post/1718201/


All Articles