gpt4 book ai didi

asp.net - Asp.net 网络表单中的 CSS

转载 作者:太空宇宙 更新时间:2023-11-04 14:33:16 25 4
gpt4 key购买 nike

我在网络表单中添加了一个 CSS。 css 可以很好地处理 html 文件,也可以在 visual studio 的设计 View 中使用。但是在IIS中运行时,css不显示。请帮帮我。

CSS

body{
background: #efefef;
}

.head
{
margin-top:0px;
min-height:40px;
min-width: 102%;
background-color:green;
color:blue;
text-align:center;
margin-left:-10px;
margin-right:0px;
padding-top:10px;

}
#content
{
margin-top:10px;
margin-bottom:10px;
margin-left:0px;
min-height:100%;

}
#wrapper
{
width:83%;
min-height:inherit;
background-color:red;
float:left;
}
#sidebar
{
width:15%;
float:right;
}
#sidebar1
{
background-color:green;
min-height:20%;
margin-bottom:2px;
}
#sidebar2
{
min-height:40%;
background-color:blue;
margin-bottom:2px;
}
#sidebar3
{
background-color:violet;
min-height:40%;
}

HTML

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs"             Inherits="_Default" %>
<link type="text/css" rel="stylesheet" href="E:\Demo\main.css" />
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div class="head">Thiagarajar College of Engineering</div>
<div id="content">
<div id="wrapper">
srini
</div>
<div id="sidebar">
<div id="sidebar1">ji</div>
<div id="sidebar2">sr</div>
<div id="sidebar3">ni</div>
</div>
</div>
</form>
</body>
</html>

最佳答案

您的 CSS 文件位置错误。

1) 通常,CSS 文件应该在 head 标签内。 (虽然你可以把它放在 body 标签内的任何地方,但我不推荐它)。

2) 另外,链接应该是相对路径而不是E:\Demo\main.css

<head runat="server">
<title></title>
<link href="/main.css" rel="stylesheet" type="text/css" />
</head>

关于asp.net - Asp.net 网络表单中的 CSS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18973055/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com