2020-05-15----CSS中的选择器(1)

CSS中的选择器(1)

选择器(8种)

内部样式,写在style标签里。
1./*通配选择器 */

	 *{
		margin: 0;
	}

2./*标签选择器 */

	div{
		width: 100px;
		height: 100px;
		background-color: red;	
	}

3./*id选择器 */

	#box{
		width: 100px;
		height: 100px;
		background-color: tan;
	}

4./*类型选择器 */

	.box1{
		width: 200px;
		height: 200px;
	}

5./*群组选择器 */

	.box2,.box3{
		border-radius: 100px;
	}

6-8种下一遍博文 link.

示例代码
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title></title>
	</head>
	<!--style标签,内部样式-->
	<style type="text/css">
		/*通配选择器*/
		*{
			margin: 0;
		}
		
		/*
		 内联样式大于内部样式
		 内联样式中存在的属性 在内部样式中是不可以被改变的
		 * */
		/*标签选择器*/
		div{
			width: 100px;
			height: 100px;
			background-color: red;	
		}
		
		/*id选择器*/
		#box{
			width: 100px;
			height: 100px;
			background-color: tan;
		}
		
		/*类型选择器*/
		.box1{
			width: 200px;
			height: 200px;
		}
		.box2{
			background-color: thistle;
			border: 1px solid black;
		}
		.box3{
			background-color: tomato;
		}
		
		/*群组选择器*/
		.box2,.box3{
			border-radius: 100px;
		}
		
	</style>
	<body>
		<!--内联样式-->
		<div style="height: 50px;">内联样式</div>
		<!--id标签,唯一标识 有且只有一个不可以重复-->
		<div id="box">id选择器</div>
			<!--类型 可以有多个也可以重复-->
		<div class="box1 box2">类型选择器1</div>	
		<div class="box1 box3">类型选择器2</div>
		
	</body>
</html>

效果展示在这里插入图片描述
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值