博主信息
博文 9
粉丝 0
评论 0
访问量 4978
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
3月21日作业
好的博客
原创
565人浏览过

<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

<title>1.基本选择器</title>

<style type="text/css">

/*元素选择器*/

ul {   

padding: 0;

margin: 0;

width: 450px;

border: 1px dashed #666;

padding: 10px 5px;

}


ul:after {  /*子块撑开父块*/

content:'';  /*在子元素尾部添加空内容元素*/

display: block;  /*并设置为块级显示*/

clear:both;   /*清除二边的浮动*/

}

li { 

list-style: none; /*去掉默认列表项样式*/

float: left;  /*左浮动*/

width: 40px;  /*设置宽度*/

height: 40px; /*设置高度*/

line-height: 40px; /*文本垂直居中*/

text-align: center; /*文本水平居中*/

border-radius: 50%; /*设置边框圆角*/

background: skyblue; /*背景色天蓝*/

margin-right: 5px; /*每个球之间的右外边距*/

}

#item1 {

background-color: red;

}

.green {

/*background-color: lightgreen;*/

}


ul li {  /*层级关系用空格表示*/

color: white;

}

ul * {

border: 1px solid black;

}

ul > li {   /*等价于: ul > * {} */

/*background-color: blue;*/

}

#item2 + li {

/*background-color: black; /*只有第7个小球变黑*/*/

}

#item2 ~ li {

/*background-color: coral; /*亮橙色*/*/

}

</style>

</head>

<body>

<ul>

<li id="item1">1</li>

<li>2</li>

<li>3</li>

<li class="">4</li>

<li>5</li>

<li id="item2">6</li>

<li>7</li>

<li>8</li>

<li>9</li>

<li>10</li>

</ul>

</body>

</html>

44444444444.jpg

批改状态:未批改

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

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

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