Css概要

css整合

css用于显示控制HTML

  • 关于css选择器优先级

    内联 > 内部 > 外部(默认)

1.内联

写在标签里面

<li style="color:..."></li>

2.内部

*写在HTML中 *

<style>
h3{...}
</style>

3.外部

从css引入 常用

<head>
<link rel="stylesheet" href="..引入路径"/>
</head>
  • css选择器

优先级:id > class > html标签

1.html选择器

拿标签做选择器式

h1{...}

2.id选择器

通过设置id

<h1 id="hid"></h1>
#id{...}

3.类选择器

通过设置class
可以有两个属性名 eq:class=“aa dd”

<h1 class="hid"></h1>
h1.hid{...} /* 或者*/
.hid{...}

4.关联选择器

根据嵌套设置

<ol><li></li></ol>
ol li{...}

5.选择器组

选择任意想要设置的标签

h1,h4,li{...}

6.伪类选择器

a:link{...} /*未访问*/
a:visted{...} /*已访问*/
a:hover{...} /*鼠标在链接上*/
a:active{...} /*激活链接*/
  • css3中选择器

1.关系选择器

<div>
<p></p>
<p></p>
</div>

div>p div中直接子标签p采用此样式
div+p 紧贴div后最近的p
div~p div后所有兄弟元素p

2.属性选择器
3.结构型伪类选择器
4.状态伪类选择器

  • 颜色属性

1.rgb(x,y,z) [rab(0,0,0)~rgb(255,255,255) 红 绿 蓝]
2.颜色单词 blue black
3.rgb(x%,y%,z%)
4.#16进制
5.rgba(x,y,z,k(透明度<1))
延伸:图片透明度 img.opacity{opacity:0.25;}

  • 字体属性 font
font-size字大小
font-family字体 宋体:Arial
font-stylenormal正常 italic斜体 oblique 斜体
font-weightbold 粗体(或者填数字)
font-height行高(填数字)
text-indent(…em)每段文章首行缩进几个字
text-align文本位置
text-decoration线 line-through贯穿线 underline下划线
text-shadow0px(水平移) 0px(垂直移) 0px(模糊) 颜色;
vertical-align文本垂直对齐方式 middle bottom top
letter-spacing(…px)字间距
  • 背景属性 background
background-color背景颜色
background-image背景图片 url("…")
background-repeatno-repeat不平铺 repeat-x横着平铺 repeat-y竖着平铺
background-position背景位置 ①top center 上中部…②0px -20px
background①url(…) ②定位center center ③no-repeat ④颜色
background-attachmentfixed滑动固定
background-sizex% y%
background-imagerepeating-linear-gradient(to right,颜色,颜色);渐变色
  • 边框属性border
border宽度 样式 颜色;
border-color边框 颜色
border-stylesolid实线 dotted点状线 dashed虚线
border-width边框宽度
border-left-color左边框线颜色
border-image边框其他
border-radius20px;(半径为20圆角) 20px左上 30px右上 0px右下 0px左下
box-shadow0px 0px 4px 4px rgba(…,…,…,…);
  • 内补白padding
paddig-toppadding-bottom
passing-leftpadding-right
  • 外补白margin
margin-topmargin-bottom
margin-leftmargin-right
margin100px auto;上下100px 左右居中
  • 定位属性pisition
positionabsolute绝对 fixed固定 relative相对于外层定位
top
left…
  • 布局属性
displaynone; block;块状化
float浮动 left right
clear清除 left right
overflowhidden超出隐藏
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值