【问题标题】:css not being applied completely to the tables on html5 pagecss 未完全应用于 html5 页面上的表格
【发布时间】:2012-11-01 13:13:20
【问题描述】:

我是 html5 的新手,我正在开发一些独立的 html5 页面以及它们各自的 CSS 样式。接下来的问题可能是一个非常基本的问题,但不知何故,经过大量寻找解决方案后,我决定在这里发布我的问题,希望得到一些提示/建议。

这是我的问题。我有一个带有 css 的独立 html 页面。当我在我的机器上本地打开网页时,所有 css 设置都已完美应用。然后我将它上传到我的dreamhost服务器上,上传后当我尝试打开页面时,我丢失了我在页面中使用的表格上所做的所有格式,而所有其他格式看起来都不错。格式在浏览器和 android webviews 上都会消失。我不确定在服务器上上传文件时没有应用规则的问题是什么。

以下是我在 html 页面中使用表格的方式:

<!-- Article 1 start -->

            <div class="line"></div>  <!-- Dividing line -->

            <article id="article1"> <!-- The new article tag. The id is supplied so it can be scrolled into view. -->
                <h3>Comparison Symbols</h3>

                <div class="line"></div>

                <div class="articleBody clear">

                <p> If you’re writing programs in C, you need to use comparison symbols. The symbols C uses, their meanings, and examples are shown in the following table: </p>
                <p>
                    <table>
                              <tr>
                                <th>Symbol</th> 
                                <th>Meaning</th>
                                <th>Examples</th>
                              </tr>

                              <tr>
                                <td></td>
                                <td></td>
                              </tr>

                              <tr>
                                <td> < </td>
                                <td>Less than</td>
                                <td>2 < 6</td>
                              </tr>

                              <tr>
                                <td>==</td>
                                <td>Equal to</td>
                                <td>5 == 5</td>
                              </tr>

                              <tr>
                                <td>></td>
                                <td>Greater than</td>
                                <td>8 > 5</td>
                              </tr>

                              <tr>
                                <td><=</td>
                                <td>Less than or equal to</td>
                                <td>4 <= 5</td>
                              </tr>

                              <tr>
                                <td>>=</td>
                                <td>Greater than or equal to</td>
                                <td>9 >= 5</td>
                              </tr>

                              <tr>
                                <td>!=</td>
                                <td>Not equal to</td>
                                <td>1 != 0</td>
                              </tr>
                    </table>            
                </p>
                </div>
            </article>

以下是我在 css 中用于表格格式的代码行:

/* table properties */

th {width:150px;
    text-align:left;
    font-weight:bold;
    text-decoration: underline;}
td {text-align:left}

如果有人可以提供一些建议,那将是一个很大的帮助。

【问题讨论】:

  • 如果表格 CSS 在单独的文件中,可能无法找到或打开该文件。检查远程页面上的 404 错误(chrome:检查工具 (Ctrl+Shift+I) => 控制台)。另一种选择是有另一个 CSS 文件覆盖这些规则,并且该文件无法在本地打开。检查 localhost 上的 404 错误。
  • @JanDvorak :感谢您的建议。我在远程页面和本地页面上都检查了 404 错误,但没有看到任何 404 错误。我也重新检查过,只有在与 html 页面相同的目录中的 css 文件。除表格规则外,所有其他 css 规则都运行良好。感谢您查看这个。我可以检查任何其他可能性吗?
  • 你能把我们链接到网站以便我们检查吗?
  • @JanDvorak :看起来这是服务器端的问题。该文件正在恢复到旧版本。现在一切正常。感谢您的帮助。

标签: html css html-table


【解决方案1】:

服务器上的 css 文件正在恢复到旧版本。当恢复解决并且css保留以下配置时,问题就解决了:

th {width:150px;
text-align:left;
font-weight:bold;
text-decoration: underline;}
td {text-align:left}

【讨论】:

    猜你喜欢
    • 2020-12-12
    • 2012-09-02
    • 2013-05-06
    • 1970-01-01
    • 1970-01-01
    • 2018-09-11
    • 2019-02-27
    • 1970-01-01
    • 2014-03-25
    相关资源
    最近更新 更多