CSS

CSS:Cascading Style Sheets层叠样式表。

三种实现方式:

1.内联方式           例如:<h style="color:red;width:300px">

2.内部样式表         例如:<style type="text/css">

                                                   h2{

                                                      color:blue;

                                                    }

                                            </style>

3.外部样式表         例如:建立以.css结尾的文件,引入<link rel="stylesheet" type="text/css" href=""/>

规则特性:继承性,层叠性,优先级。

选择器:

选择器组:用,隔开。

后代选择器:空格

子代选择器:>

伪类选择器:

用于选择一个元素在不同状态下的形式。

常用的有:

:link

:visited

:active

:hover

:focus

border:

用于设置元素的边框

border:width值 style值  color值

border-left:width值 style值  color值

border-right:width值 style值  color值

border-top:width值 style值  color值

border-bottom:width值 style值  color值

padding :内边距

margin:外边距

background-color:

background-image:url()

background-repeat:repeat,repeat-x,repeat-y,no-repeat

background-position:left,center,right,top,bottom

background-attachment:scroll,fixed 用于处理图片是否随页面的滚动而移动。

当内容溢出元素框时overflow:可以有以下几种处理方式:

visible

hidden

scroll

auto

设置文本:

font-family:

font-size:

font-weight:

color:

text-align:left、right、center

text-decoration:none、underline

line-height:

text-indent: 首行缩进

表格样式:

border-collapse:separate、collapse

定位:

分为5中:流定位(float:none、left、right,其中clear用于消除浮动所带来的影响。例如:clear:none、left、right、both),浮动定位,相对定位,绝对定位,固定定位。

相对定位:div{

  position:relative;

  left:50px;           (right)

  top:50px;           (bottom)

}

绝对定位:.outter{

                           position:relative;

                     }

                    .d{

                            position:absolute;

                             bottom:20px;

                             left:30px;

                      }


position:static、relative、absolute、fixed(固定定位)

偏移属性:top、bottom、left、right

z-index:层叠顺序

float/clear:浮动定位属性

列表样式:

无序列表:list-style-type:none,disc,circle,square

有序列表:list-style-type:none,decimal,lower-roman,upper-roman

图片代替:list-style-image:url()

显示:

用display:noen,block,inline,inline-block

设置鼠标样式:

cursor:default,pointer,crosshair,text,wait,help

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值