border-inline-width CSS 属性决定元素逻辑内联边框的宽度,然后根据元素的书写模式、方向性和文本方向将其转换为物理边框宽度。
为writing-mode、direction和text-orientation定义其行为,对应于border-left-width 和 border-right-width ,或 border-top-width 和 border-bottom-width 属性。
使用 border-block -width 属性,配置 border-block-start-width 和 border-block-end-width,指定垂直维度的边框宽度。
属性值
<'border-width'> -边框的宽度。
语法
border-inline-width = <'border-top-width'>{1,2}
适用范围
所有 HTML 元素。
CSS border-inline-width: 长度值
以下示例演示了 border-inline-width 和长度值的用法。
<html>
<head>
<style>
.container {
background-color: lightgreen;
width: 350px;
height: 350px;
align-items: center;
justify-content: center;
border: 2px dotted #3498db;
border-radius: 8px;
}
.demo-border {
border: 1px solid #e74c3c;
border-inline-width: 8px 15px;
padding: 10px;
text-align: center;
font-family: 'Arial', sans-serif;
font-size: 20px;
color: #333;
}
</style>
</head>
<body>
<div class="container">
<p class="demo-border">带有 border-inline-width 的示例。</p>
</div>
</body>
</html>
CSS border-inline-width: Thin
以下示例演示了 border-inline-width 与thin值的用法。
<html>
<head>
<style>
.container {
background-color: #e6cacd;
width: 350px;
height: 350px;
align-items: center;
display: flex;
justify-content: center;
border-radius: 8px;
}
.demo-border {
border: 5px solid #e74c3c;
border-inline-width: thin;
border-inline-color: black;
padding: 10px;
margin: 15px;
text-align: center;
font-family: 'Arial', sans-serif;
font-size: 20px;
color: #333;
}
</style>
</head>
<body>
<div class="container">
<p class="demo-border">具有thin值的 border-inline-width 属性的示例。</p>
</div>
</body>
</html>
CSS border-inline-width: medium
以下示例演示了 border-inline-width 和medium值的用法。
<html>
<head>
<style>
.container {
background-color: #e8e1e2;
width: 350px;
height: 350px;
align-items: center;
display: flex;
justify-content: center;
border-radius: 8px;
}
.demo-border {
border: 5px solid gray;
border-inline-width: medium;
border-inline-color: red;
padding: 10px;
margin: 15px;
text-align: center;
font-family: 'Arial', sans-serif;
font-size: 18px;
color: #333;
}
</style>
</head>
<body>
<div class="container">
<p class="demo-border">具有medium值的 border-inline-width 属性的示例。</p>
</div>
</body>
</html>
CSS border-inline-width: thick
以下示例演示了 border-inline-width以及thick值的用法 。
<html>
<head>
<style>
.container {
background-color: #fcf7f8;
width: 350px;
height: 350px;
align-items: center;
display: flex;
justify-content: center;
border-radius: 8px;
}
.demo-border {
border: 3px solid gray;
border-inline-width: thick;
border-inline-color: red;
padding: 10px;
margin: 15px;
text-align: center;
font-family: 'Arial', sans-serif;
font-size: 20px;
color: #333;
}
</style>
</head>
<body>
<div class="container">
<p class="demo-border">具有thick值的 border-inline-width 属性的示例。</p>
</div>
</body>
</html>
CSS border-inline-width: 书写模式
以下示例演示了 border-inline-width 属性与长度的用法值和垂直书写模式。
<html>
<head>
<style>
.custom-container {
background-color: #f9f9f9;
width: 350px;
height: 350px;
display: flex;
align-items: center;
justify-content: center;
border: 4px dashed #27ae60;
border-radius: 10px;
}
.custom-border {
writing-mode: vertical-rl;
border: 2px solid #e67e22;
border-inline-width: 10px;
padding: 15px;
text-align: center;
font-family: 'Verdana', sans-serif;
font-size: 20px;
color: #333;
}
</style>
</head>
<body>
<div class="custom-container">
<p class="custom-border">带有属性 border-inline-width 的示例。</p>
</div>
</body>
</html>