博主信息
博文 7
粉丝 0
评论 0
访问量 6184
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
0704课后作业
沈帅@迪联¹³³²²²¹⁸⁵⁶⁹的博客
原创
714人浏览过

实例

实例

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>css选择器</title>
    <link rel="stylesheet" href="static\css\style11.css">
</head>
<body>
<ul>
    <li class="lei">1</li>
    <li id="idxzq">2</li>
    <li class="xd">3</li>
    <li>4</li>
    <li>5</li>
    <li>6</li>
    <li>7</li>

</ul>
</body>
</html>

运行实例 »

点击 "运行实例" 按钮查看在线实例

style页
显示盒子小圆球,用到了,marging,padding,border
/*标签选择器*/
ul{
    border: 1px dashed red;
    margin: 0 auto;
    padding-left: 0 ;
}
/*层级选择器*/
ul li{
    list-style: none;
    width: 70px;
    height: 70px;
    background-color: green;
    text-align: center;
    text-align: ;
    line-height: 50px;
    border-radius: 50%;
    display: inline-block;
    margin-left: 10px;
    box-shadow: 10px 10px 5px #888888;
}
/*类选择器*/
.lei{
    background-color: aqua;
}
/*id选择器*/
#idxzq{
    background-color: red;
}

li[id="idxzq"]{
   border:2px solid dodgerblue;
}
伪类选择器
<ul> :frist-child
{
    background-color: red;
}
<ul> :last-child
{
    background-color: red;
}
<ul> :nth-child(9)
{
    background-color: red;
}
div:first-of-type  :nth-child(3) {
    background-color: darkcyan;
}


鼠标点击,按钮发生变化

button:hover{
   width:56px;
   height:28px;
   background-color: blue;
   color:white;
   border-radius: 20px;

}


form :invalid {
   color: red;
   display: block;

}

点击鼠标,文本框发生变色

form :focus{
   background-color: #888888;
}运行实例 »

点击 "运行实例" 按钮查看在线实例

2.

选择器的引用,都是用CLASS,和id吗?

比如老师你写的这选择器

在html页怎么引用,是用class还是id

/* 伪类: 类型选择器 */
ul li:first-of-type {
   background-color: darkorchid;  /* 第一个li类型的元素背景为紫色 */
   color: white;
}

我测试出来,会用了

批改状态:合格

老师批语:能认真的完成作业, 不仅是学习态度好, 还是成功的基本素质, 你一定能学会的
本博文版权归博主所有,转载请注明地址!如有侵权、违法,请联系admin@php.cn举报处理!
全部评论 文明上网理性发言,请遵守新闻评论服务协议
0条评论
作者最新博文
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号

  • 登录PHP中文网,和优秀的人一起学习!
    全站2000+教程免费学