HTML DOM Style unicodeBidi 属性
htmlweb developmentfront end technology更新于 2025/6/11 9:48:17
HTML DOM Style unicodeBidi 属性返回并修改文本是否应与 direction 属性一起被覆盖以支持同一 HTML 文档中的多种语言。
语法
以下是语法 −
返回 unicodeBidi
object.style.unicodeBidi
修改 unicodeBidi
object.style.unicodeBidi = “value”
值
此处,值可以是负号
| 值 | 说明 |
|---|---|
| inherit | 从其父元素继承此属性值。 |
| initial | 将此属性值设置为其默认值。 |
| normal | 不设置额外的嵌入级别。 |
| embed | 设置额外的嵌入级别。 |
| bidi-override | 设置额外的嵌入级别并根据方向重新排序属性。 |
示例
让我们看一个 HTML DOM Style unicodeBidi 属性的示例 −
<!DOCTYPE html>
<html>
<head>
<style>
body {
color: #000;
background: lightblue;
height: 100vh;
text-align: center;
}
.btn {
background: #db133a;
border: none;
height: 2rem;
border-radius: 2px;
width: 40%;
display: block;
color: #fff;
outline: none;
cursor: pointer;
margin: 1rem auto;
}
</style>
</head>
<body>
<h1>DOM Style transformStyle Property Example</h1>
<p style="direction:ltr">This is a paragraph element with some dummy text.</p>
<button onclick="add()" class="btn">Set unicodeBidi</button>
<script>
function add() {
document.querySelector('p').style.direction = "rtl";
document.querySelector('p').style.unicodeBidi = "bidi-override";
}
</script>
</body>
</html>
输出
这将产生以下输出 −

点击"设置 unicodeBidi"按钮在段落元素上设置 unicodeBidi CSS 属性。

相关文章
有用资源
html 参考教程 - 该教程包含有关 html 的更多信息:https://www.cainiaomax.com/html/

