-webkit-text-security

非標準:此特性未標準化。我們不建議在生產環境中使用非標準特性,因為它們瀏覽器支援有限,並且可能會更改或被移除。但是,在沒有標準選項的特定情況下,它們可以是合適的替代方案。

-webkit-text-security 是一個非標準 CSS 屬性,它透過用形狀替換字元來模糊 <form> 欄位(例如 <input><textarea>)中的字元。它隻影響不是 type=password 的欄位。

語法

css
-webkit-text-security: circle;
-webkit-text-security: disc;
-webkit-text-security: square;
-webkit-text-security: none;

/* Global values */
-webkit-text-security: inherit;
-webkit-text-security: initial;
-webkit-text-security: revert;
-webkit-text-security: revert-layer;
-webkit-text-security: unset;

正式語法

-webkit-text-security = 
circle |
disc |
square |
none

示例

模糊文字輸入

嘗試在下面的欄位中輸入。如果您的瀏覽器支援此屬性,字元應該會被方塊視覺替換。

HTML

html
<label for="name">Name:</label> <input type="text" name="name" id="name" />

CSS

css
input {
  -webkit-text-security: square;
}

結果

規範

不屬於任何標準。

瀏覽器相容性

另見