css - 为什么我的 css 更改没有得到反射(reflect)?

标签 css html border

我的 css 更改没有反射(reflect)在 html5 中,没有大括号问题在其他一些路径中,我也在其他一些浏览器中运行它,但问题似乎就在那里。

这是我的 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>

有人可以告诉我我做错了什么吗?没有反射(reflect)任何 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>

关于css - 为什么我的 css 更改没有得到反射(reflect)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39647124/

相关文章:

css - DIV 没有环绕它的子元素?

html - 如何减小移动媒体查询中占位符的字体大小

php - AJAX Post 突然停止工作?

ios - 有没有一种简单的方法可以在 Xcode for iOS 5.1 中为 View 添加边框

image - 以编程方式在图像中加载纹理并为图像设置边框 Unity

javascript - 滚动到该 div 后如何使 div 固定?

html - 使用 CSS3/HTML5 的不均匀框阴影?

html - 如何在 SASS 中使用不带引号的变量格式化文本?

javascript - 如何在 2d Canvas 和 WebGL Canvas 之间共享纹理?

ios - 为非方形UIImage添加边框