0
点赞
收藏
分享

微信扫一扫

【html+css】css字体文本样式

花姐的职场人生 2022-02-27 阅读 56
csshtml

css字体文本样式

1.字体


 /* 1.默认字号16 */            
font-size: 30px;
/* 2.加粗 */            
font-weight: 700;            
/* 3.斜体 */           
font-style: italic;
/* 4.字体 */            
/* 多个即为优先级 */            
font-family: 微软雅黑,宋体,sans-serif,serif,monospace;            /*  
(1)无衬线字体:微软雅黑[sans-serif]                
(2)衬线字体:宋体[serif]                
(3)等宽字体 [monospace]*/

/* 层叠性即为覆盖性 */            
color: red;            
color: aquamarine;
/* 一个属性跟多个值,是复合属性 */            
/* font: style weight size family */            
font: italic 700 66px 宋体;           
 /* 可省略前两个【变为默认】 */            
font:  66px 宋体;

2.文本


 /* 1. 文本缩进  */            
 text-indent: 50px;            
 /* 缩进两格【一个格是1em】 */            
 text-indent: 2em;
 /* 2. 水平对齐方式 【默认左】*/            
 text-align: right;            
 text-align: center;
 body {            
 /* 图片居中用body */            
 text-align: center;        
 }
/* 3. 文本修饰 */            
/* 下划线 */            text-decoration:underline;            
/* 删除线 */            text-decoration: line-through;            
/* 上划线 */            text-decoration: overline;            
/* 无装饰 */            text-decoration: none;

行高

谷歌调试: fn+f12

/* line-height: 50px; */            
/* 间距是字号的1.5倍 */            line-height: 1.5;             
/* font: style weight size/line-height family */             
font: 50px/2 微软雅黑,宋体,sans-serif,serif,monospace;

标签居中

div {            
width: 300px;            
height: 300px;            
background-color: pink;            
margin: 0 auto;        }
举报

相关推荐

0 条评论