css

1, css和html结合方式
之一
html标签都有个style属性,用来写css
《div style = “color : red; border-left: 25px solid blue;”> hello world 《/div>

之二
在head标签中使用style标签专门封装css样式
《head>
《style type=”text/css”>
div,span{
color : red;
font-size : 24px;
}
《/style>
《/head>
之三
如果css样式过多,可以将css代码导入到一个单独.css文件中,在要引用的html文件中引用即可。
《style type=”text/css”>
@import url(“1.css”);
《/style>

之四
用link标签引入css文件
《link rel=”stylesheet” type=”text/css” href=”all.css”/>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

2.CSS选择器
选择器:即表示哪些标签将受这些css样式控制

2.1 标签名选择器
《style type=”text/css”>
div{
border: 1px solid blue;
width: 200px;
}
《/style>

2.2 id选择器
《style type = “text/css”>
#id属性:{
css代码
}
《/style>

2.3 class选择器 (类选择器)
《style type=”text/css”>
.class属性{
css代码
}
《/style>

2.4 组合选择器
可以将你想要实现相同style的标签,id,class以逗号分割 表示他们共用同一样式
《style type=”text/css”>
标签,# id, .class{}

2.5关联选择器
父标签 子标签{
css代码
}
.cl1 span{
color: red;
background-color: green;
}

2.6伪元素选择器

:link 表示某个标签未被访问时的样式
:hover 鼠标悬停在上面的样式
:active 鼠标点击瞬间的样式
:visited 被访问后的样式

a : link { font-size : 9px;
text-decoration : underline;
}

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值