Architect's Log

I'm a Cloud Architect. I'm highly motivated to reduce toils with driving DevOps.

CSS 疑似クラスセレクタ(:active)

入力によってアクティブになった要素にスタイルを適用します。

使用例

<!DOCTYPE html>
<html lang="ja">
<head>
<title>Hello! CSS</title>
<meta charset="UTF-8">
<style>
input:active {
    background:  pink;
}
</style>
</head>
<body>
<form id="order" action="./order.html" method="post">
<p><label for"sei">姓:</label><input id="sei" type="text"></p>
<p><label for"mei">名:</label><input id="mei" type="text"></p>
</form>
</body>
</html>

レンダリング(Chrome)

クリックしている間だけスタイルが適用されます。

関連エントリー

CSSエントリーのまとめ - プログラマーな日々
CSSに関するエントリーのまとめページです。 ...