Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to style textbox using CSS in ASP.NET

Tags:

css

asp.net

I want to add style in ASP.NET textbox control. I couldn't find textbox element in elements list. I can put style in all input controls using the below code in CSS.

input
{
backgroud-color:black;
}

But this changes the background color of all input controls like buttons, radiobox, etc.

I want to do it exclusively with textbox, I don't want to do it with CSS class.

like image 567
Vaibhav Jain Avatar asked Oct 30 '09 09:10

Vaibhav Jain


2 Answers

It would be easier to put css class on those textboxes (input type="text")

<style>
   .textbox { /*some style here */ }
</style>

<input type="text" class="textbox" /> or
<asp:TextBox id="someid" runat="server" CssClass="textbox" />
like image 98
jerjer Avatar answered Nov 09 '22 23:11

jerjer


This will do it:

input[type=text]

Though it might not work in all browsers (e.g. IE). The only way to ensure that would be to add a class or put it inside a span element.

like image 30
richeym Avatar answered Nov 10 '22 00:11

richeym