CSS中(font和background)的简写形式
转自:http://blog.csdn.net/shenzhennba/article/details/7356095
1.字体属性主要包括下面几个:
font-family(字体族): “Arial”、“Times New Roman”、“宋体”、“黑体”等;
font-style(字体样式): normal(正常)、italic(斜体)或oblique(倾斜);
font-variant (字体变化): normal(正常)或small-caps(小体大写字母);
font-weight (字体浓淡): 是normal(正常)或bold(加粗)。有些浏览器甚至支持采用100到900之间的数字(以百为单位);
font-size(字体大小): 可通过多种不同单位(比如像素或百分比等)来设置, 如:12xp,12pt,120%,1em
如果用 font属性的话,就可以把几个样式进行简化,减少书的情况;font 属性的值应按以下次序书写(各个属性之间用空格隔开):
font-style | font-variant | font-weight | font-size | font-family
例如:
.fontStyle01{
font-style: italic;
font-variant: normal
font-weight: bold;
font-size: 30px;
font-family: arial, sans-serif;
}
上面的样式简写为:
.fontStyle01{font:italic normal bold 12px arial,verdana;}
2.背景
background-color:#999999; //元素的背景色
background-image : url("path/bgFile.gif"); //设置背景图像
background-repeat : repeat-x | repeat-y | repeat | no-repeat; //设置重复方式
background-attachment : fixed | scroll; //设置背景图片的固定方式
background-position : X轴坐标,Y轴坐标[top,bottom,center,left,right,20px,10%]; //设置背景的左上角位置,坐标可以是以百分比或固定单位
background缩写各个值的次序依次如下:
background-color | background-image | background-repeat | background-attachment | background-position
如果省略某个属性不写出来,那么将自动为它取缺省值。比如,如果去掉background-attachment和background-position的话:
background: #FFCC66 url("butterfly.gif") no-repeat;
例如:
.bg01{
background-image: url("path/bgFile.gif");
background-repeat: no-repeat;
background-attachment: fixed;
background-position: left top;
}
上面可以简写为:
.bg01{
background:#FFCC66 url("path/bgFile.gif") no-repeat fixed left top;
}
补充:background-size
取值:
1、value1 value2
宽度 高度
2、value1% value2%
百分比
3、cover
覆盖,将背景图像等比缩放,直到背景能够覆盖到元素的所有区域
4、contain
包含,将背景图像等比缩放,直到背景图像碰到右边或下边时,停止缩放。
CSS中(font和background)的简写形式的更多相关文章
- CSS中对图片(background)的一些设置心得总结
写网页的时候很多情况需要对图片进行操作,如何在不进行专业的美工裁切操作的情况下而让自己的素材度达到最大的满意度呢,这是一个问题,对于懒得开ps切图的我,通常会直接在网络上download一张图片,直接 ...
- CSS 中Font Awesome 图标(附码表)
HTML中缩放的矢量图标,您可以使用CSS所提供的所有特性对它们进行更改,包括:大小.颜色.阴影或者其它任何支持的效果. Font Awesome 传送门:http://fontawesome.das ...
- css中 font常用的样式属性
今天我总结一下文本常用的字体样式 1.font常用样式 1)字体类型 语法:font-family: +字体类型: 如: font-family:宋体; 2)字体大小 语法:font-size: ...
- css 中font属性知识点总结
一. font属性值可以继承.例如子元素可以继承父元素的行高,字体大小等等. 二.font属性可以进行连写:font: font-sytle font-weight font-size/line- ...
- CSS中常用的简写模式
一.font属性简写 font-style:字体样式 normal 默认值.浏览器显示一个标准的字体样式. italic 浏览器会显示一个斜体的字体样式. oblique 浏览器会显示一个倾斜的字体样 ...
- TP5.1:将外部资源引入到框架中(css/js/font文件)
为了让我们的框架形式变得更加好看,我们需要加入Bootstrap和Jq文件到框架中 1.通过Bootstrap和jq官网进行相关文件的下载 (1)Bootstrap下载地址:https://v3.bo ...
- CSS 中关于background 属性功能
background 是 css中的核心属性,我们对他应该充分了解. background-image 定义背景图像 这个属性是我们用的最多的属性 设置背景图像有两个方式 background: ...
- css中background背景属性概
css中background背景属性概 background:url(背景图片路径) no-repeat;/*不重复默认在左上方*/background:url(背景图片路径) no-repeat ...
- CSS 背景图像 background属性简写
background属性简写 background属性可以像margin padding属性一样,有简写方法,它的简写顺序是: background-color background-image ba ...
随机推荐
- nginx优化——包括https、keepalive等
一.nginx之tcp_nopush.tcp_nodelay.sendfile 1.TCP_NODELAY你怎么可以强制 socket 在它的缓冲区里发送数据?一个解决方案是 TCP 堆栈的 TCP_ ...
- svn 更新lib库时,报错
svn: E195012: Unable to find repository location for svn:// in revision 9718 Can't revert without re ...
- div 绑定keyup
参考 https://www.cnblogs.com/Struts-pring/p/4290740.html <div tabindex="-1" onkeyup=" ...
- tab template
<div class="box"> <div class="box-body"> <div class="nav-tab ...
- springboot org.hibernate.MappingException: No Dialect mapping for JDBC type: -9
参考 https://www.cnblogs.com/luxd/p/8316243.html https://www.cnblogs.com/s648667069/p/6478559.html @Co ...
- mysql数据库解决中文乱码的问题
http://jingyan.baidu.com/article/647f0115937be97f2148a894.html 一个一劳永逸的方法, 修改mysql的配置文件my.ini 在这个配置文件 ...
- Android笔记:Button
示例代码摘自<第一行代码> ButtonDemo.java的代码: public class ButtonDemo extends Activity { @Override protect ...
- STL:unordered_set/unordered_multiset(c++11)
unordered_set:容器内的元素无序排列,基于值进行获取单个元素速度非常快.内部根据它们的 hash value 被组织成 buckets(slot). unordered_multiset: ...
- VMware Ubuntu安装
不是每一个程序员都必须玩过linux,只是博主觉得现在的很多服务器都是linux系统的,而自己属于那种前端也搞,后台也搞,对框架搭建也感兴趣,但是很多生产上的框架和工具都是安装在服务器上的,而且有不少 ...
- empty 与 remove 的区别
empty()移除指定元素中的所有子节点,拿$("p").empty()来说,他只是把<p>dsfsd</p>中的文本给移除了,而留下 了<p> ...