Search code examples
htmlcssasp.nettwitter-bootstrapright-to-left

ASP.NET Textbox align text left to right in a right to left webpage


I have a website that is supposed to have a right to left alignment. I have installed the Right to Left version of the bootstrap and it works well.

The alignment also affects the text in the Textboxes. I want to add a Css class or something that would make the text in the TextBoxes be aligned Left to Right while keeping the rest of the components Right to Left.

I have tried to add

text-align: left; 
direction:ltr;

To the textbox css but it doesn't affect the text at all.

Can someone help me with this?


Solution

  • You could try adding !important; to your style:

    text-align: left !important;
    direction:ltr !important;
    

    It may be because there are already styles forcing right to left. important!; will over-ride these.

    Have you tried applying it directly to the textbox?

    <asp:TextBox ID="tb" CssClass="align-left" runat="server" />
    
    .align-left {
         text-align: left !important;
    }