Please see aspx page below, I have a text box that I am trying to italicize the placeholder text. Do I use css? I’ve never really used so if so please show with example. Thanks!
<asp:TextBox ID ="txtMyTextBox" runat="server" ClientIDMode="Static" MaxLength="30" Width="115px" placeholder="Text Box"></asp:TextBox>
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
So you want to style the place holder of your textbox control. Follow this format to structure it:
::placeholder {
/* your css declarations; */
}
And if you want to style different textboxes differently, you can add styles like below to your textbox.
<style>
.MyTextBox::placeholder {
color:red;
font-style: italic; /*I see you needed an example for italic text*/
}
</style>
<asp:TextBox ID ="txtMyTextBox"
runat="server" ClientIDMode="Static"
MaxLength="30" Width="115px"
CssClass="MyTextBox"
placeholder="Text Box">
</asp:TextBox>
Working Example:
.MyTextBox::placeholder {
color:red;
font-style: italic; /*I see you needed an example for italic text*/
}
<input type="text" class="MyTextBox" placeholder="Hello World"/>
For IE 10-11:
.MyTextBox:-ms-input-placeholder { /* Internet Explorer 10-11 */
color: red;
}
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0