c5_labsci/web/admin/demo/front/demo_cssn.html
2026-01-27 00:52:00 +08:00

50 lines
1.3 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html>
<head>
<title>未来关注的CSS</title>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
<link href="/jscss/style.css" rel="stylesheet" type="text/css" />
<style>
.c1:focus-within {
background-color: #e9f2ff;
}
.c2>label:has(+div>.imp)::after{
content: "*";
color: red;
}
.c3::selection{
background-color: #498ff1;
color:#973bee;
}
</style>
</head>
<body>
父元素设置focus-within伪类子元素获取焦点父类响应。
<div class="ciy-form c1">
<label>关注</label>
<div>
<input type="text"/>
</div>
</div>
父元素选择器,子元素满足条件,父类响应。(CSS4特性兼容性暂时不好)
<div class="ciy-form c2">
<label>必填项</label>
<div>
<input type="text" class="imp"/>
</div>
</div>
选中的样式
<div class="c3">
选中样式效果
选中样式效果
选中样式效果
选中样式效果<br/>
选中样式效果
选中样式效果
</div>
</body>
</html>