CSS基础学习(文本样式、背景图)(二)

一、文本样式

1、css文本属性

属性描述
color设置文本颜色
direction设置文本方向。
letter-spacing设置字符间距
line-height设置行高
text-align对齐元素中的文本
text-decoration向文本添加修饰
text-indent缩进元素中文本的首行
text-shadow设置文本阴影
text-transform控制元素中的字母
unicode-bidi设置或返回文本是否被重写 
vertical-align设置元素的垂直对齐
white-space设置元素中空白的处理方式
word-spacing设置字间距
/*rgb(0%,100%,0%);数字:0~255;百分比:0%~100%; #00880a;十六进制*/
.p1{color: bisque;}
/* 设置字体排布 ,默认向左, left,center,right*/
.p2{text-align:center;}
/* 设置或删除文本的装饰 ,none,overline,line-through,underline*/
.p3{text-decoration:none;}
/* 设置字体的粗细,100-900,默认正常的字体粗细,但是比如说如果你设置900,
最粗的字体,但是如果你的系统没有这样粗的字体,依然会按照默认的样式显示。 */
.p4{font-weight: normal;}
/* 文字的行高 */
.p5{line-height: 200px;}	
/* 文字阴影 
text-shadow:水平偏移距离 垂直的偏移距离 模糊度 阴影的颜色 */
.p6{text-shadow:0px 0px 5px black;}				

2、css字体属性

Property描述
font在一个声明中设置所有的字体属性
font-family指定文本的字体系列
font-size指定文本的字体大小
font-style指定文本的字体样式
font-variant以小型大写字体或者正常字体显示文本。
font-weight指定字体的粗细。
对font的定义参数必须按照如下的排列顺序。
font : font-style || font-variant || 
       font-weight || font-size ||
       line-height || font-family
例子:p { font: italic small-caps 600 12pts/18pts 宋体; }

font-style
p.normal {font-style:normal;} 正常
p.italic {font-style:italic;} 斜体
p.oblique {font-style:oblique;} 倾斜的文字

二、背景图

Property描述
background简写属性,作用是将背景属性设置在一个声明中。
background-attachment背景图像是否固定或者随着页面的其余部分滚动。
background-color设置元素的背景颜色。
background-image把图像设置为背景。
background-position设置背景图像的起始位置。
background-repeat设置背景图像是否及如何重复。
background-size   设置属性规定背景图像的尺寸。             

当使用简写属性时,属性值的顺序为::

  • background-color
  • background-image
  • background-repeat
  • background-attachment
  • background-position
 background-image: url(img/bg-little.png);/*背景图*/
 background-repeat: no-repeat; /*背景图只显示一张*/
 background-position: bottom left;/*背景图定位*/
 background-attachment: fixed;/*scroll  随着滚动出现   fixed保持在页面上*/
 /* background-repeat:repeat; */ /*背景图无线重复铺满页面*/
 /*background-repeat:repeat-x;*//*背景图 x轴 无线重复铺满页面*/
 /*background-repeat:repeat-y;*//*背景图 y轴 无线重复铺满页面*/
 /* background-color: rgb(255,0,0); *//*背景颜色*/
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值