Reputation: 385
I have an asp.net form in which I am trying to apply some font settings to a textbox through css.This is what I have in my CSS:
body
{
}
@font-face {
font-family: 'Lohit Devanagari',serif;
src: url('http://fonts.googleapis.com/earlyaccess/lohitdevanagari.css');
font-weight: normal;
font-style: normal;
}
.txtQues
{
font-family: 'Lohit Devanagari',serif;
font-size:14px;
background-color:Yellow;
}
Below is a part of my page source where I have added the css to the page:
<head>
<title>Question Master</title>
<link href="../FontSettings.css" rel="stylesheet" type="text/css" />
<meta name="google-translate-customization"
content="3280487709591956- dc3fc45d489f056a-g5378ebab0cbcd0a4-12"/>
</head>
The TextBox:
<asp:TextBox ID="txtQuestion" runat="server" Height="101px" TextMode="MultiLine" Width="627px" meta:resourcekey="txtQuestionResource1" EnableTheming="True"
ontextchanged="txtQuestion_TextChanged" CssClass="txtQues"></asp:TextBox>
As soon as I apply the css to the form, I see a change in the color of the text box in the design window, which tells me that css is being applied,but when I run the code on the browser I find that neither the text box color changes nor the font.Kindly help me and let me know where am I going wrong.
Upvotes: 0
Views: 165
Reputation: 13988
In the below code remove "EnableTheming" or make it false.
<asp:TextBox ID="txtQuestion" runat="server" Height="101px" TextMode="MultiLine" Width="627px" meta:resourcekey="txtQuestionResource1" EnableTheming="True" ontextchanged="txtQuestion_TextChanged" CssClass="txtQues"></asp:TextBox>
Also try to keep important for your styles in CSS like below.
.txtQues
{
font-family: 'Lohit Devanagari',serif !important;
font-size:14px !important;
background-color:Yellow !important;
}
Upvotes: 0
Reputation: 5426
Remove the @font-face
and import the file. The css allready uses font-face. Try:
@import url("http://fonts.googleapis.com/earlyaccess/lohitdevanagari.css");
body
{
}
.txtQues
{
font-family: 'Lohit Devanagari',serif;
font-size:14px;
background-color:Yellow;
}
Upvotes: 1