CSS - border-inline-end 属性



CSS border-inline-end 是一个简写属性,用于在一个语句中定义多个不同的逻辑内联结束边框属性 border-inline-end-widthborder-inline-end-styleborder-inline-end-color。书写模式、文本方向和方向决定边框的方向。

语法

border-inline-end: border-inline-end-width border-inline-end-style border-inline-end-color | initial | inherit;

属性值

描述
border-inline-end-width 它指定元素在内联方向末端的边框宽度。默认值为 medium。
border-inline-end-style 它指定元素在内联方向末端的边框样式。默认值为 none。
border-inline-end-color 它指定元素在内联方向末端的边框颜色。默认值为当前边框颜色。
initial 这将属性设置为其默认值。
inherit 这从父元素继承属性。

CSS 内联结束边框属性示例

以下示例说明了使用不同值的 border-inline-end 属性。

定义内联结束边框属性的所有值

要在一个语句中设置 border-inline-end-widthborder-inline-end-styleborder-inline-end-color 的值,我们使用 border-inline-end 属性。三个属性的值可以在一个语句中给出。以下示例显示了如何执行此操作。

示例

<!DOCTYPE html>
<html>

<head>
   <style>
      .container {
         background-color: lightgray;
         padding: 20px;
         width: 100vh;
         height: 350px;
         display: grid;
         align-items: center;
         justify-content: center;

      }

      .borders {
         color:blue;
         border: 1px solid black;
         margin: 15px;
         padding: 20px;
         text-align: center;
      }

      .border1 {
         border-inline-end: 6px solid #3498db;
      }

      .border2 {
         border-inline-end: 8px double #9900ff;
      }

      .border3 {
         border-inline-end: 10px dashed #009900;
      }
   </style>
</head>

<body>
   <h2>
      CSS border-inline-end property
   </h2>
   <div class="container">
      <p class="borders border1">
         This border shows the boder-inline-end 
         property with 6px width, solid style 
         and #3498db color.
      </p>
      <p class="borders border2">
         This border shows the boder-inline-end
         property with 8px width, double style
         and #9900ff color.
      </p>
      <p class="borders border3">
         This border shows the boder-inline-end
         property with 10px width, dashed style
         and #009900 color.
      </p>
   </div>
</body>

</html>

内联结束边框属性的组成属性

border-inline-end 属性是 border-inline-end-widthborder-inline-end-styleborder-inline-end-color 属性的组合。以下示例显示了如何组合使用这些属性来显示 border-inline-end 属性效果。

示例

<!DOCTYPE html>
<html>

<head>
   <style>
      .container {
         background-color: lightgreen;
         padding: 20px;
         width: 100vh;
         height: 350px;
         display: grid;
         align-items: center;
         justify-content: center;

      }

      .borders {
         color:blue;
         border: 1px solid black;
         margin: 15px;
         padding: 20px;
         text-align: center;
      }

      .border1 {
         border-inline-end-width: 8px;
         border-inline-end-style: dashed;
         border-inline-end-color: red;
      }

      .border2 {
         border-inline-end-width: 8px;
         border-inline-end-style: dotted;
         border-inline-end-color:  orange;
      }

   </style>
</head>

<body>
   <h2>
      CSS border-inline-end property
   </h2>
   <div class="container">
      <p class="borders border1">
         This border shows the boder-inline-end
         property with 8px width, dashed style 
         and red color.
      </p>
      <p class="borders border2">
         This border shows the boder-inline-end
         property with 8px width, dotted style 
         and orange color.
      </p>
   </div>
</body>

</html>    

带书写模式的内联结束边框属性

border-inline-end 属性受书写模式的影响,书写模式决定内联结束边框的方向。在垂直书写模式下,它影响底部边框,而在水平书写模式下,它影响右边框。以下示例显示了这些。

示例

<!DOCTYPE html>
<html>

<head>
   <style>
      .container {
         background-color: lightgreen;
         padding: 20px;
         width: 100vh;
         height: 350px;
         display: grid;
         align-items: center;
         justify-content: center;

      }

      .borders {
         color:blue;
         border: 1px solid black;
         margin: 15px;
         padding: 20px;
         text-align: center;
      }

      .border1 {
         border-inline-end: 8px dashed red;
         writing-mode: horizontal-tb ;
      }

      .border2 {
         border-inline-end: 8px dashed red;
         writing-mode: vertical-rl;
      }

   </style>
</head>

<body>
   <h2>
      CSS border-inline-end property
   </h2>
   <div class="container">
      <p class="borders border1">
         This border shows the boder-inline-end
         property with 8px width, dashed style and
         red color with horizontal writing mode.
      </p>
      <p class="borders border2">
         This border shows the boder-inline-end 
         property with 8px width, dashed style and 
         red color with vertical writing mode.
      </p>
   </div>
</body>

</html>

带方向的内联结束边框属性

border-inline-end 属性受方向的影响,方向也决定内联结束边框的方向。使用 rtl(从右到左)值时,会影响左边框;使用 ltr(从左到右)值时,会影响右边框。以下示例显示了这些。

示例

<!DOCTYPE html>
<html>

<head>
   <style>
      .container {
         background-color: lightgray;
         padding: 20px;
         width: 100vh;
         height: 350px;
         display: grid;
         align-items: center;
         justify-content: center;

      }

      .borders {
         color:blue;
         border: 1px solid black;
         margin: 15px;
         padding: 20px;
         text-align: center;
      }

      .border1 {
         border-inline-end: 8px dashed red;
         direction: rtl ;
      }

      .border2 {
         border-inline-end: 8px dashed red;
         direction: ltr;
      }

   </style>
</head>

<body>
   <h2>
      CSS border-inline-end property
   </h2>
   <div class="container">
      <p class="borders border1">
         This border shows the boder-inline-end property
         with 8px width, dashed style and red color with
         right-to-left direction.
      </p>
      <p class="borders border2">
         This border shows the boder-inline-end property
         with 8px width, dashed style and red color 
         with left-to-right direction.
      </p>
   </div>
</body>

</html>

支持的浏览器

属性 Chrome Edge Firefox Safari Opera
border-inline-end 69.0 79.0 41.0 12.1 56.0
css_properties_reference.htm
广告