【问题标题】:top white line and css reset not working顶部白线和css重置不起作用
【发布时间】:2017-06-29 15:35:27
【问题描述】:

在这里,我正在构建的页面上出现“顶部白线”的典型问题,在这种情况下,经典的 css 重置 不起作用。

表格的黑色边框和浏览器中的黑色线条之间有一条细小的白线。


这是页面的骨架:

* {
  margin: 0;
  padding: 0;
  border: 0;
  outline: 0;
}

body {
  font-family: "Lato", sans-serif;
}

#menu {
  width: 12%;
  height: 100%;
  float: left;
  position: relative;
  background-color: #ff0000;
}

#list {
  top: 140px;
  width: 100%;
  position: absolute;
}

#list a:hover {
  color: #a6a6a6;
}

ul {
  list-style: none;
  background-color: #ff0000;
}

li {
  width: 95%;
  padding: 12px 0px 12px 15px;
}

li a {
  font-size: 25px;
  color: #ffffff;
  display: block;
  white-space: nowrap;
  text-decoration: none;
  transition: 1.0s;
}

#header {
  z-index: 1;
  height: 10%;
  width: 100%;
  position: relative;
  background-color: #0066ff;
}

table {
  width: 100%;
  height: 100%;
  position: absolute;
}

table,
td {
  border: 1px solid black;
}

td {
  color: #ffffff;
  text-align: center;
}

#title {
  font-size: 30px;
  width: 90%;
}

#logout {
  font-size: 20px;
  width: 10%;
}

img {
  float: right;
  width: 50%;
  height: 90%;
  margin: auto;
  opacity: 0.2;
}
<div id="menu">
  <div id="list">
    <ul>
      <li> </li>
      <li> <a href="#">Customers</a> </li>
      <li> <a href="#">Students</a> </li>
      <li> <a href="#">Teachers</a> </li>
      <li> <a href="#">Android</a> </li>
    </ul>
  </div>
</div>

<div id="header">
  <table>
    <tr>
      <td id="title">
        <p> Android Panel </p>
      </td>
      <td id="logout">
        <p> Logout </p>
      </td>
    </tr>
  </table>
</div>

<img src="https://image.freepik.com/free-vector/android-boot-logo_634639.jpg " />

如您所见,我正在对页面中的每个元素应用 css 重置,作为 StackOveflow suggests 上的一些问题。

我想了解,我在这个 css 中有哪些配置,这对 css 重置的配置有任何阻力,或者可能是这里缺少哪个配置。

P.S:我正在使用 Google Chorme

【问题讨论】:

标签: html css


【解决方案1】:

我建议做的一件事是查看页面的计算框模型及其中的特定元素。这可以帮助您找到导致我听起来像 1px 边距的原因。由于您使用的是 chrome,因此开发工具快捷方式是 ctrl+shift+I。

我在 Firefox 和 Chrome 中查看了您的页面,似乎没有白线。它可能是您使用的浏览器版本,但可能并非如此。

在查看您的屏幕截图时,我注意到您可能正在谈论的白线。这只是chrome浏览器界面的一部分。如果您想在没有界面的情况下查看您的网站,只需在浏览器中按键盘上的 f11 即可。这会让您进入全屏模式。

您的浏览器的自定义主题也可能导致它看起来不同,看起来像是您网页的一部分。

【讨论】:

  • 嘿,杰克。如果您想在答案中添加“Chrome 的自定义主题,可能是放置这条小白线的人,因为我正在对所有元素应用 CSS 重置”,请随意。我删除了我在浏览器上使用的自定义主题。 F11 是一个不错的提示:)。谢谢。
猜你喜欢
  • 2016-12-06
  • 2013-05-02
  • 1970-01-01
  • 2020-10-08
  • 1970-01-01
  • 1970-01-01
  • 2012-07-26
  • 2011-11-10
  • 2016-03-22
相关资源
最近更新 更多