【问题标题】:C# Asp.net Site.css missing a portion when compiledC# Asp.net Site.css 编译时缺少一部分
【发布时间】:2021-04-18 20:51:54
【问题描述】:

我在 Asp.net 中添加了一些 css 来格式化表格,在编辑器中它看起来正是我想要的,但是当我启动我的应用程序时,当我检查源代码时表格的 css 丢失了,有人知道我在做什么吗做错了,是设计器有问题还是我的代码有问题?

Visual Studio 中的 My Site.css

/* Move down content because we have a fixed navbar that is 50px tall */
body {
    padding-top: 50px;
    padding-bottom: 20px;
}

/* Wrapping element */
/* Set some basic padding to keep content from hitting the edges */
.body-content {
    padding-left: 1px;
    padding-right: 1px;
}

/* Set widths on the form inputs since otherwise they're 100% wide */
input,
select,
textarea {
    max-width: 280px;
}

/* Tables */
table, th, td {
    border: 1px solid black;
}
table{
    width:100%;
}
tr:nth-child(even){
    background-color: #eee;
}

tr:nth-child(odd){
    background-color: #fff;
}

th{
    color: white !important; 
    background-color: black !important;
}
/* Responsive: Portrait tablets and up */
@media screen and (min-width: 768px) {
    .jumbotron {
        margin-top: 20px;
    }

    .body-content {
        padding: 0;
    }
}

当我使用 Opera 检查器检查 Site.css 时

/* Move down content because we have a fixed navbar that is 50px tall */
body {
    padding-top: 50px;
    padding-bottom: 20px;
}

/* Wrapping element */
/* Set some basic padding to keep content from hitting the edges */
.body-content {
    padding-left: 1px;
    padding-right: 1px;
}

/* Set widths on the form inputs since otherwise they're 100% wide */
input,
select,
textarea {
    max-width: 280px;
}


/* Responsive: Portrait tablets and up */
@media screen and (min-width: 768px) {
    .jumbotron {
        margin-top: 20px;
    }

    .body-content {
        padding: 0;
    }
}

【问题讨论】:

    标签: html css asp.net


    【解决方案1】:

    根据我的评论 - 可能是缓存问题。在隐身浏览器中尝试,看看是否还有问题!

    【讨论】:

      【解决方案2】:

      可能你忘记给类文件名与你称为“body-content”的名称完全相同尝试在你的类中给出确切的名称,如下所示:cssclass=“body-content”它会起作用,如果它是external css 在您页面的 head 部分提供外部链接。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2018-09-17
        • 1970-01-01
        • 1970-01-01
        • 2017-10-22
        • 1970-01-01
        • 2014-10-12
        • 2017-04-17
        • 2016-04-05
        相关资源
        最近更新 更多