我有一个非常奇怪的问题。我只想画两条简单的线,它们之间的距离有点远。
这是 html:
<div class="hline">
</div>
<div class="hline">
</div>
还有 CSS:
html, body {
background-color: white;
}
.hline {
background-color: black;
height: 2px;
margin: 50px;
}
当 body 的背景颜色是白色时,它工作得很好,但是当它是黑色的时候,我的 div 的背景颜色是白色的,黑色背景中似乎只有一条大白线。这是为什么?
非常感谢,
卢克:D
最佳答案
对我有用
<!DOCTYPE html>
<html>
<head>
<title></title>
<style type="text/css">
html,
body {
background-color: black;
}
.hline {
background-color: white;
height: 2px;
margin: 50px;
}
</style>
</head>
<body>
<div class="hline">
</div>
<div class="hline">
</div>
</body>
</html>
关于html - 如何使用 CSS 中默认背景颜色之外的另一种背景颜色绘制线条?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32935646/