Blogger Information
Blog 27
fans 1
comment 2
visits 25170
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
360浏览页面横幅变色(0322)
一枝黄花
Original
723 people have browsed it

今天是在PHP中文网学习的第5天,今天开始学习CSS,

基本选择器代码

实例

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>基本选择器</title>
</head>
<body>

<style type="text/css">
	ul {   
		border: 0;
			font-size: 30px;
		}
		
		li { 
			list-style: none; /*去掉默认列表项样式*/
			float: left;  /*左浮动*/
			width: 150px;  /*设置宽度*/
			height: 40px; /*设置高度*/
			line-height:30px; /*文本垂直居中*/
			text-align:center; /*文本水平居中*/	
			margin-right:20px; /*每个球之间的右外边距*/
		}
#item2{
	color:red;
}
.yellow{
	color:blue;
	}
.blue{
	color:red;
	}
#item1+li{
	color: brown;
}
#item2~li{
	 color:pink;
}
</style>
<img src=" images/360.png" width="100%">
<hr>
<ul type="none">
<li class="blue"><b> 推荐网站</li>
<li id="item1">新闻头条</li>
<li>电视剧</li>
<li>最新电影</li>
<li class="yellow">小游戏</li>
<li class="yellow">小说大全</li>
<li id="item2">旅游度假</li>
<li>网上购物</li>
<li>娱乐八卦</li>
<br/>
</ul>
</body>
</html>

运行实例 »

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

属性选择器代码

实例

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>属性选择器</title>
</head>
<body>
<style type="text/css">
ul{
width: 500px;
font-size: 30px;
padding: 0;
margin: 0;
line-height: 40px;
border: 2px red solid ;
}
*[id]{
	background-color: green;
}
li[class="red"]{
	background-color: yellow;
}
li[class^="html"]{
	background-color: red;
}
li[class~="t"]{
	background-color: brown;
}
li[class*="o"]{
	background-color: pink;
}
</style>
<ul type="none">
<li class="red">中午好你吃饭了吗?</li>
<li class="brown yellow" >吃了什么菜呢?</li>
<li id="item1">我还没有吃呢</li>
<li class="brown ">你吃饭了吗?</li>
<li class="html">正在考虑吃什么呢</li>
<li id="item2">别想了随便吃点吧</li>
</ul>
</body>
</html>

运行实例 »

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

手写基本选择器代码

4.jpg

Correction status:qualified

Teacher's comments:作业已检查!! 一如既往的很不错!!继续保持下去!!!加油!
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments