日期:2014-05-18  浏览次数:20495 次

在aspx中用.css怎么没有效果,帮我看看,错在哪里?
<head   runat= "server ">
        <link   href=StyleSheet.css   type= "text/css "   rel=STYLESHEET>
</head>

<body>
        <form   id= "form1 "   runat= "server ">
        <div>
                <asp:Button   ID= "SearchButton "   runat= "server "   CssClass= "Button1 "   OnClick= "Button1_Click "   Text= "search "   /> &nbsp;
                <asp:Button   ID= "ExcelButton "   runat= "server "   Text= "Excel "   OnClick= "ExcelButton_Click "   /> &nbsp;
                <input   id= "Button1 "   type= "button "   class= "Button1 "   value= "button "   /> <br   />
                <br   />
                  </div>
        </form>
</body>
</html>

StyleSheet.css   内容:

body   {
}
Button1
{
width:   280px;
color:   green;
background-color:   blue;
text-decoration:   underline;
}


------解决方案--------------------
<head>
<meta http-equiv= "Content-Type " content= "text/html; charset=gb2312 ">
<link href=StyleSheet.css type= "text/css " rel=STYLESHEET>
</head>

试试
------解决方案--------------------
那个CSS文件有问题,一般HTML标签中是不要点的,而你的 <asp:Button ID= "SearchButton " runat= "server " CssClass= "Button1 " OnClick= "Button1_Click " Text= "search " /> 中CssClass表示类,所以你需要在那个样式文件中将Button1前面加个圆点。
------解决方案--------------------
试试这样
input.button
{
width: 280px;
color: green;
background-color: blue;
text-decoration: underline;
}然后调css的时候写class= "button "
------解决方案--------------------
lz确定css路径是对的?
仅仅.button1{}就可以了吧
------解决方案--------------------
如果样式定义正确
如果引用的样式文件路径也正确
那么可以再检查一个你的文档规范
如果文档规范为: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN " "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
可以将它改为: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN ">
试试