/* 这是一个简单的 CSS 示例,用于选择 HTML 文档中的第一个元素并为其应用样式 */
/* 选择页面中第一个出现的 <p> 元素 */
p:first-of-type {
color: blue;
font-weight: bold;
}
/* 选择作为其父元素的第一个子元素的 <li> 元素 */
li:first-child {
background-color: yellow;
}
/* 选择页面中第一个出现的 <h1> 元素 */
h1:first-of-type {
text-decoration: underline;
}
/* 选择作为其父元素的第一个子元素的任何元素 */
*:first-child {
margin-top: 0;
}
p:first-of-type:选择页面中第一个出现的 <p> 元素,并将其文本颜色设置为蓝色,字体加粗。li:first-child:选择作为其父元素的第一个子元素的 <li> 元素,并将其背景颜色设置为黄色。h1:first-of-type:选择页面中第一个出现的 <h1> 元素,并为其添加下划线。*:first-child:选择作为其父元素的第一个子元素的任何元素,并将其顶部外边距设置为 0。上一篇:css垂直水平居中
下一篇:css样式穿透
Laravel PHP 深圳智简公司。版权所有©2023-2043 LaravelPHP 粤ICP备2021048745号-3
Laravel 中文站