CSS三:操作属性

目录

一、字体属性

1、font-size(字体大小)

p {
  font-size: 14px;
}

 font-size 属性可设置字体的尺寸

  px:像素,稳定和精确

  %:把 font-size 设置为基于父元素的一个百分比值,布局时用到。

  em:移动端字体样式大小,相对于其父元素来设置字体大小

  rem:可以换算为各种移动端,相对于根元素来设置字体大小

2、font-weight(字体粗细)

 font-weight字重,可用来调整字体粗细。

描述
normal 默认值,标准粗细
bord 粗体
border 更粗
lighter 更细
100~900 设置具体粗细,400等同于normal,而700等同于bold
inherit 继承父元素字体的粗细值
/*font-weight: normal;*/
/*font-weight: bold;*/
/*font-weight: bolder;*/
font-weight: 500;

3、font-family(字体系列)

body {
  font-family: "Microsoft Yahei", "微软雅黑", "Arial", sans-serif;
}

  font-family可以把多个字体名称作为一个“回退”系统来保存。如果浏览器不支持第一个字体,则会尝试下一个。浏览器会使用它可识别的第一个值。

二、文字属性

1、text-align(文本匹配)

  text-align 属性规定元素中的文本的水平对齐方式。

描述
left 左边对齐 默认值
right 右对齐
center 居中对齐
justify 两端对齐

2、text-decoration(文字装饰)

描述
none 默认。定义标准的文本。
underline 定义文本下的一条线。
overline 定义文本上的一条线。
line-through 定义穿过文本下的一条线。
inherit

继承父元素的text-decoration属性的值。

  具体使用时,还可以同时设置线的颜色。

text-decoration: underline blue;

  运用最频繁的还是消除a标签的默认样式:

text-decoration: none;

3、cursor光标

p{
    text-decoration: underline blue;
    color: blue;
    cursor: pointer;  /* point在鼠标移上去时,光标呈现为指示链接的指针(一只手) */
}

as的阿萨德

猜你喜欢

转载自www.cnblogs.com/xiugeng/p/9118449.html