定義と使い方
-webkit-text-stroke-colorプロパティは、テキスト文字のアウトライン(ストローク)の色を設定するためのプロパティです。プロパティの使い方や例などについて解説します。
- テキストのアウトライン(外枠)の色を設定するこのプロパティ以外にも、アウトラインの太さを設定する
-webkit-text-stroke-widthプロパティがあります。 - そして、これら2つのプロパティをまとめて指定できるショートハンドプロパティ(shorthand property)として、
-webkit-text-strokeプロパティがあります。
基本例
TEXT STROKE
形式構文
selector {
-webkit-text-stroke-color: <color>
}
構文
/* <color>値 */
-webkit-text-stroke-color: red;
-webkit-text-stroke-color: #00a0e9;
-webkit-text-stroke-color: currentcolor;
-webkit-text-stroke-color: rgba(0, 0, 0, 0.4);
/* グローバル値 */
-webkit-text-stroke-color: inherit;
-webkit-text-stroke-color: initial;
-webkit-text-stroke-color: revert;
-webkit-text-stroke-color: revert-layer;
-webkit-text-stroke-color: unset;
値
<color> |
色相値 |
|---|
公式定義
| 初期値 | currentcolor (現在の文字色) |
|---|---|
| 適用対象 | すべての要素 |
| 継承 | はい |
| アニメーション | はい |
活用例
<style>
.text {
font-size: 47px;
font-weight: 900;
color: white;
-webkit-text-stroke-width: 1px;
-webkit-text-stroke-color: red;
}
</style>
<p class="text">TEXT STROKE</p>
TEXT STROKE
ブラウザーの互換性
| プロパティ |
デスクトップ Chrome
|
デスクトップ Edge
|
デスクトップ Firefox
|
Safari
|
|---|---|---|---|---|
-webkit-text-stroke-color
|
1 | 15 | 49 | 3 |
仕様書
| 仕様書 | |
|---|---|
-webkit-text-stroke-color
|
Compatibility Standard #the-webkit-text-stroke-color |
関連項目
- CSS -webkit-text-strokeプロパティ:テキストの外枠(アウトライン)スタイルの設定
- CSS text-decorationプロパティ:テキスト装飾のショートハンドプロパティ
- CSS text-emphasisプロパティ:テキスト強調マークのショートハンド
- CSS text-shadowプロパティ:テキストに影の効果
- CSS caret-color:テキストカーソルの色を変更
- Webカラー色コード表:HTML,CSS カラーコード一覧表 (背景色や文字色の設定)
- ウェブカラーのカラーコード:カラーピッカー(Color Picker、カラー選択ツール)
- Webカラー色コード表:HTML,CSS カラーコード一覧表 (背景色や文字色の設定)
- CSS -webkit-text-stroke-widthプロパティ:テキストの縁取り(輪郭線)の太さの設定