常用的CSS标签(前端面试)

本文全面介绍了CSS的各种样式属性,包括字体、文本、区块、盒子、漂浮、定位、透明度、背景、边框、列表样式、垂直方向排列以及链接和光标的设置方法,是前端开发者不可或缺的参考指南。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

一、字体——font

1)大小|font-size: x-large;(特大) xx-small;(极小) 单位:PX、PD
2)样式 |font-style: oblique;(偏斜体) italic;(斜体) normal;(正常)
3) 行高|line-height: normal;(正常) 单位:PX、PD、EM
4) 粗细 |font-weight: bold;(粗体) lighter;(细体) normal;(正常)
5) 变体 |font-variant: small-caps;(小型大写字母) normal;(正常)
6)字体|font-family

二、文本——text

1) 修饰 |text-decoration: underline;(下划线) overline;(上划线) line-through;(删除线) blink;(闪烁)
2) 大小写 |text-transform: capitalize;(首字母大写) uppercase;(大写) lowercase;(小写) none;(无)
3)排列对齐|text-align:justify;left;right;center
4)缩进|text-indent:数值;inherit
5)阴影|text-shadow:数值

三、区块——block

1)行高|line-height: 数值;inherit;normal
2)字间距|letter-spacing: 数值;inherit;normal
3)词间距|word-spacing: 数值;inherit;normal
4)空格|white-space: pre(保留);nowrap(不换行);normal
5)显示|display

  • none
  • block(把内联标签变成块级标签)
  • inline(把块级标签变成内联标签)
  • list-item(列表项)
  • run-in(追加部分)
  • compact(紧凑)
  • marker(标记)
  • inline-table
  • table-raw-group
  • table-header-group
  • table-footer-group
  • table-raw
  • table-column-group
  • table-column
  • table-cell
  • table-caption|表格标题
五、盒子——box

1)width: 数值;百分比;auto
2)height: 数值;百分比;auto
3)清除|clear: none;left;right;both
4)边界|margin: 上 右 下 左
5)填充|padding: 上右 下 左
6)定位|position: relative;absolute;static;
7)透明度|visibility: visible;hidden;inherit
8)溢出|overflow: visible;hidden;scroll auto
9)裁切|clip: rect(12px,auto,12px,auto)

六、漂浮——float

float:left;right;none

七、定位——position

position: absolute;relative;fixed

八、透明度——opacity

opacity: 数值

九、背景——background

1)背景颜色|background-color:数值
2)背景图片|background-image:url()
3)背景图片重复|background-repeat:inherit;repeat;no-repeat;repeat-x;repeat-y
4)滚动|background-attachment:fixe;scroll
5)背景位置|background-position:数值;top;bottom;left;right;center(填写两个值时就是x和y值)
简写|background:背景颜色 背景图像 背景重复 背景附件 背景位置

十、边框——border

1)边框样式|border-style:dotted(点线);dashed(虚线);solid(实线);double(双线);groove(槽线);ridge(脊状);inset(凹陷);outset(凸显)
2)边框宽度|border-width
3)边框颜色|border-color:上 右 下 左

十一、列表样式——list-style

1)类型|list-style-type:none(不编号);decimal(阿拉伯数字);upper-alpha(大写英文字母);lower-alpha(小写英文字母);upper-roman(大写罗马数字);lower-roman(小写罗马数字);circle(空心圆圈);disc(实心圆圈);square(实心方块)
2)位置|list-style-position:inside;outside
3)图像|list-style-image:url
简写|list-style:类型 位置 url

十二、垂直——vertical

垂直方向排列|vertical-align:sub(下标字);super(上标字);top;bottom;middle;text-top;text-bottom

十三、链接——a
  • a(所有超链接)
  • a:link(超链接文字格式)
  • a:visited(浏览过的链接文字格式)
  • a:active(按下链接的格式)
  • a:hover(鼠标转到链接时)
十四、光标——cursor

cursor:hand(手指);crosshair(十字体);move(箭头朝右);wait(漏斗);text(文字型);help(加问号);s-resize(箭头朝下);n-resize(箭头朝上);ne-resize(箭头朝右上);nw-resize(箭头朝左上);se-resize(箭头朝右下);sw-resize(箭头朝左下)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值