星空网 > 软件开发 > 网页设计

css 常用样式

font-family 设置字体名称

可以使用多个名称,用逗号分隔,浏览器则按照先后顺序依次使用可用字体

p { font-family:'宋体','黑体','Arial'; }

font-size 设置字体大小

length 用长度值指定文字大小,不允许负值

percentage 用百分比指定文字大小,其百分比取值是基于父对象中字体的尺寸,不允许负值

p { font-size:14px;}

font-weight 控制字体粗细

normal 正常的字体,相当于数字值400

bold 粗体,相当于数字值700

100~900 定义由细到粗的字符

p { font-weight:bold;}

font-style 控制字体是否倾斜

normal 指定文本字体样式为正常的字体

italic 指定文本字体样式为斜体,对于没有设计斜体的特殊字体,如果要使用斜体外观将应用oblique

oblique 指定文本字体样式为倾斜的字体,人为的使文字倾斜,而不是去选取字体中的斜体字

p { font-style: normal; }p { font-style: italic; }p { font-style: oblique; }

font(字体样式缩写)

例:p{font-style: italic;font-weight: bold;font-size: 14px;line-height: 22px;font-family:'宋体';}缩写后:p { font: italic bold 14px/22px '宋体'; }

 

color 文本颜色

  • 英文单词,比如:red,yellow,green …
  • 十六进制表示方式,#开头,6个十六进制的字符或数字组合,比如:#FFFFFF,#000000 …
  • RGB模式,红 0-255,绿 0-255,蓝 0-255,比如:RGB(120,33,234)
  • RGBA模式,比如:RGBA(255,0,0,0.5),最后的A表示透明度50%

text-decoration 文本装饰线条

none 默认。定义标准的文本

underline 定义文本下的一条线

overline 定义文本上的一条线

line-through 定义穿过文本的一条线

blink 定义闪烁的文本

h1 {text-decoration:overline;}h2 {text-decoration:line-through;}h3 {text-decoration:underline;}

text-shadow 文本阴影

h-shadow 必需。水平阴影的位置。允许负值

v-shadow 必需。垂直阴影的位置。允许负值

blur 可选。模糊的距离

color 可选。阴影的颜色

h1{ text-shadow: 2px 2px 2px #ff0000;}

 

宽度 width : auto | length

高度 height : auto | length

p { width:300px;}div { width:50%;}img { height:200px;}div { height:100px;}

外边距 margin : auto | length

margin-top 设置上边的外边距

margin-bottom 设置下边的外边距

margin-left 设置左边的外边距

margin-right 设置右边的外边距

缩写型式:

margin: 上边距  右边距  下边距  左边距

margin: 上下边距  左右边距

margin: 上边距  左右边距  下边距

div { width:300px; height:100px; margin:10px;}div { width:300px; height:100px; margin:0 auto;}

内边距 padding : length

padding-top 设置上边的内边距

padding-bottom 设置下边的内边距

padding-left 设置左边的内边距

padding-right 设置右边的内边距

div { width:300px; height:100px; padding:10px;}

透明度 opacity : <number>

number值为 0.0-1.0 之间的小数

兼容全浏览器的写法:

div{ filter:alpha(opacity=50); } /* IE6-IE8 */div{ opacity:0.5; } /* 现代浏览器 */

 




原标题:css 常用样式

关键词:CSS

CSS
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

做外贸需要注意的几个重点细节 你做到了几个?:https://www.ikjzd.com/articles/133354
拉美电商MercadoLibre:第三季度净收入达11.2亿美元:https://www.ikjzd.com/articles/133355
阿里2021财年Q2业绩:跨境及全球批发商业同比增长44%:https://www.ikjzd.com/articles/133356
中欧班列今年开行量突破万列:https://www.ikjzd.com/articles/133357
品牌备案遭幕后黑手移除!A+失效,卖家走投无路......:https://www.ikjzd.com/articles/133358
2020年8个黑五营销技巧帮助您促进销售:https://www.ikjzd.com/articles/133359
永康白云风景区怎么走 白云山风景区怎么去??:https://www.vstour.cn/a/363181.html
2022世界杯门票如何买?:https://www.vstour.cn/a/363182.html
相关文章
我的浏览记录
最新相关资讯
海外公司注册 | 跨境电商服务平台 | 深圳旅行社 | 东南亚物流