[英]Why css is not getting applied to my web page?
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: 我有一个asp.net表单,我试图通过CSS将一些字体设置应用于文本框,这就是我的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: 以下是我的页面源代码的一部分,在其中我已将css添加到页面中:
<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. 将CSS应用于表单后,立即在设计窗口中看到文本框颜色的变化,这告诉我正在应用css,但是当我在浏览器中运行代码时,我发现没有文本框颜色更改或字体更改。请帮助我,让我知道我要去哪里了。
Remove the @font-face
and import the file. 删除
@font-face
并导入文件。 The css allready uses font-face. css allready使用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;
}
In the below code remove "EnableTheming" or make it false. 在下面的代码中删除“ EnableTheming”或将其设置为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. 还要尝试保持样式对CSS的重要性,如下所示。
.txtQues
{
font-family: 'Lohit Devanagari',serif !important;
font-size:14px !important;
background-color:Yellow !important;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.