CSS border-left-style 属性

CSS border-left-style 属性设置元素左边框的样式。
它被定义为从可用于边框样式属性的关键字中选择的单个关键字。

该属性用于设置元素所有四个边的样式,但是border-left-style只设置了左边框的样式。

左边框的默认宽度为中等。
可以使用 border-left-width 或者 border-width 属性更改它。

并非所有浏览器都以相同的方式呈现样式。
例如,Chrome 将点呈现为矩形点,而不是圆形点。

该规范没有指定点和破折号之间的间距量。

该规范没有定义不同样式的边框如何在角落中连接。

初始值none
应用于所有元素。它也适用于::first-letter。
继承
可动画的
版本CSS1
DOM 语法object.style.borderLeftStyle=“solid”;

CSS border-left-style 属性值说明

说明
none定义没有任何边框。默认值。
hidden与“none”相同,只是在表元素的边界冲突解决中。
dotted定义虚线边框。
dashed定义虚线边框。
double定义双边框。
solid定义实体边框。
groove定义三维凹槽边框。它的效果可以随边框颜色的值而改变。
ridge定义三维脊状边界。它的效果可以随边框颜色的值而改变。
inset定义三维插入边框。它的效果可以随边框颜色的值而改变。
outset定义三维边界。它的效果可以随边框颜色的值而改变。
initial将属性设置为其默认值。
inherit从父元素继承属性。

语法

border-left-style: none | hidden | dotted | dashed | solid | double | groove | ridge | inset | outset | initial | inherit;

border-left-style 属性示例:

<!DOCTYPE html>
<html>
  <head>
    <style>
      p {
        border-left-style: solid;
      }
      div {
        border-left-style: dotted;
      }
    </style>
  </head>
  <body>
    <p> border-left-style 实线示例</p>
    <div> border-left-style 点线示例</div>
  </body>
</html>

根据边框颜色的值,可以更改groove、ridge、inset和outset值的效果。

具有所有值的 border-left-style 属性示例:

<!DOCTYPE html>
<html>
  <head>
    <title>Title of the document</title>
    <style>
      body {
        background: #c9c5c5;
        font-size: 20px;
        text-align: center;
      }
      main div {
        display: flex;
        align-items: center;
        justify-content: center;
        color: black;
        padding-top: 30px;
        padding-bottom: 30px;
        width: 200px;
        height: 100px;
        margin: 15px;
        font-weight: bold;
        background-color: #8ebf42;
        border: 10px solid;
      }
      .flex-center {
        display: flex;
        justify-content: center;
      }
      /* border-left-style example classes */
      .b1 {
        border-left-style: hidden;
      }
      .b2 {
        border-left-style: dotted;
      }
      .b3 {
        border-left-style: dashed;
      }
      .b4 {
        border-left-style: solid;
      }
      .b5 {
        border-left-style: double;
      }
      .b6 {
        border-left-style: groove;
      }
      .b7 {
        border-left-style: ridge;
      }
      .b8 {
        border-left-style: inset;
      }
      .b9 {
        border-left-style: outset;
      }
    </style>
  </head>
  <body>
    <h1>Border-left-style value examples</h1>
    <main class="flex-center">
      <div class="b1">
        hidden
      </div>
      <div class="b2">
        dotted
      </div>
      <div class="b3">
        dashed
      </div>
    </main>
    <main class="flex-center">
      <div class="b4">
        solid
      </div>
      <div class="b5">
        double
      </div>
      <div class="b6">
        groove
      </div>
    </main>
    <main class="flex-center">
      <div class="b7">
        ridge
      </div>
      <div class="b8">
        inset
      </div>
      <div class="b9">
        outset
      </div>
    </main>
  </body>
</html>
日期:2020-06-02 22:14:18 来源:oir作者:oir