html - 我不明白为什么 border 属性不起作用

标签 html css

<分区>


这个问题是由于错别字或无法再重现的问题引起的。虽然类似的问题可能是on-topic在这里,这个问题的解决方式不太可能帮助 future 的读者。

关闭 3 年前

<pre>
  <head>
    <style>
       body{
        background-color: blue;
       }
      .a
      {
        background-color: white;
        display: block;
        margin: auto;
         border-color: white;
         border-style: solid;
         border-radius: 10px;
        text-align: center;
        border-color: black;
        border-radius: 2px;
        width: 400px;
        height: 600px;
      }
    </style>
  </head>
  <body>
    <div class="a">
      <h1>SignUp</h1>
    </div>
  </body>
</pre>

我不明白为什么 border 属性不起作用请向我解释。 (我删除了基本标签,因为网站说代码太多)。

最佳答案

问题是:

border-color: white;
border-color: black;

您设置了两次边框颜色。

enter image description here

两次设置相同的属性是一种非常糟糕的做法。删除其中任何一个后,代码将按预期工作。

关于html - 我不明白为什么 border 属性不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59442535/

上一篇:javascript - 来自父级的左右元素

下一篇:javascript - jQuery addClass() 方法

相关文章:

javascript - 在水平之前砌筑垂直填充

jquery - 如何在 fill 属性中使用 url

css - 在鼠标悬停时更改 sibling 背景

javascript - jQuery addClass 似乎无法在 Internet Explorer 中运行

html - 如何防止跨度随内容增长

javascript - 管理 HTML5 DIV 大小

javascript - Bootstrap 图标未显示在 Internet Explorer 中

css - 在 wordpress 的 php 文件中查找标签

html - 如何在 window phone 8 上禁用缩放

jquery - 从顶部删除标题