为什么我的 css 更改没有得到反映?

Why my css changes are not getting reflected?

我的 css 更改没有反映在 html5 中,没有大括号问题我也做了 ctrl + f5 和我 运行 在其他一些路径中使用相同的代码,我也在其他一些浏览器中 运行 它,但问题似乎就在那里。

这是我的 HTML 代码:

.div1 {
  max-width: 50%;
  border: 1px;
  /*background-color : "red";*/
}
.div2 {
  max-width: 50%;
  /*background-color : "blue";*/
}
.div3 {
  max-width: 50%;
  /*background-color :"green";*/
}
<div class="div1">p</div>
<div class="div2">q</div>
<div class="div3">r</div>

有人可以告诉我我做错了什么吗?任何 CSS 更改都没有反映出来 我看到没有任何 div

的白色文档

你的 border 语法错误,因为你没有设置 border-style.

正式语法是这样的:

<br-width> || <br-style> || <color>

以下是数值:

<br-width>

Default value medium is used if absent. See border-width.

<br-style>

Default value none is used if absent. See border-style.

<color>

A <color> denoting the color of the border. If not set, its default value is the value of the element's color property (the text color, not the background color). See border-color.


.div1 {
  max-width: 50%;
  border: 1px solid;
  /*background-color : "red";*/
}
.div2 {
  max-width: 50%;
  /*background-color : "blue";*/
}
.div3 {
  max-width: 50%;
  /*background-color :"green";*/
}
<div class="div1">p</div>
<div class="div2">q</div>
<div class="div3">r</div>

尝试使用特定颜色和类型的边框,例如:

border : 1px solid red;

给边框加上颜色 border:1px solid black

有背景颜色background-color :green;(N.B:颜色名称没有引号)