html_css结合方式以及选择器

<!--注意在使用不同的结合方式时需要把其他的结合方式注释掉,或去掉要使用的方法的注释,不然看不出来效果 -->

<!--html文件  -->

<!DOCTYPE html>

<html>
<head>
<meta charset="UTF-8">
<title>html_css结合方式极其选择器</title>
<!--第2种结合方式  -->
<!-- <style type="text/css">


</style> -->
<!--第3种结合方式  -->
<link rel="stylesheet" type="text/css" href="1.css">
</head>


<body>


<!--结合方式:由上到下,由外到内,优先级由低到高,后加载的优先级高  -->
<div style="background: red; color: green;">第1种结合方式</div>
<div>第2种结合方式</div>
<div>第3种结合方式,标签选择器</div>
<div class="three">第3种结合方式,class选择器</div>
<div id="three">第3种结合方式,id选择器</div>
<!-- 选择器优先级:style > id选择器 > class选择器 > 标签选择器 -->
</body>

</html>




/* css文件 */
@CHARSET "UTF-8";


/* 标签选择器 */
div {
background: black;
color: purple;
}
/* class选择器  */
.three {
background: purple;
color: white;
}


/* id选择器  */
#three {
background: yellow;
color: red;
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值