CSS中font-size、font-family、line-height顺序以及简写属性

顺序:

font-size       line-height       font-family

body { font-size: 12px};
h1 { font: bold 200%/1.2 Verdana, Arial, sans-serif }

  其中line-height是一个文本属性,但是还可以作为对font-size值的补充,并用一个斜线(/)与之分隔。200%/1.2

  

  在使用简写属性font时,所有被忽略值都会重置为默认值。

h1,h2, h3 { font: italic 250% sans-serif };
h2 { font: 200% sans-serif }
h3 { font-size: 150%}

  结果如图:

  为什么h2没有italic效果呢?

  因为简写属性忽略的值会被重置为默认,而h3  font-size不是简写属性所以会继承

时间: 2024-08-28 15:04:19

CSS中font-size、font-family、line-height顺序以及简写属性的相关文章

css中margin:auto什么意思?margin:auto属性的用法详解

我们都知道使用margin:auto可以让元素水平居中的.但你有没有想过使用margin:auto可以让元素水平居中的原因,要回答这个问题,我们首先需要看一下margin:auto的工作原理.auto如果它适用于垂直居中,那么又是一种什么情况,下面我们来看具体内容. 首先auto是做什么的? 定义auto元素,因元素类型和上下文而异.在边距中,auto可以表示两种情况:占用可用空间或0 px.这两个将为元素定义不同的布局. “自动”占用可用空间 这是我们利用auto最常见的用法.通过分配auto

Generate eps plot with appropriate font size and line width in GNU Octave

Because eps terminal is different from the one for screen display, the font size and line width should all be adjusted as the following example: clist = GenColorList(); h = 1; figure(h); clf(h); # This is mandatory. ## Set the axis position. Sometime

css中font系列常见内容

font 可以一次性定义以下五种属性的值,常见的是前四种.不用所有的都写上,有什么些什么,没有的不写,各个属性值之间用空格. 说实话,如果能够单独写就单独写,真不知道这样写有什么样的好处,还麻烦 注意:书写的顺序 font-style font-variant font-weight font-size/line-height font-family 另外还有一些别的属性值:主要是应用在一些特殊的应用场景的制定字体,比如下拉列表.按钮.对话框.图标标记.窗口状态栏等等 caption 定义被标题

CSS Sprites+CSS3 Icon Font

CSS Sprites+CSS3 Icon Font 先马上等有空一定看看转载于http://www.cnblogs.com/jingwhale/p/4280073.html CSS Sprites在国内很多人叫CSS精灵,是一种网页图片应用处理方式.它允许你将一个页面涉及到的所有零星图片都包含到一张大图中去,这样一来,当访问该页面时,载入的图片就不会像以前那样一幅一幅地慢慢显示出来了.根据具体图标在大图上的位置,给背景定位. CSS Sprites加速的关键,不是降低质量,而是减少个数. 做成

深入了解css的行高Line Height属性

来源:http://www.cnblogs.com/fengzheng126/archive/2012/05/18/2507632.html 什么是行间距? 古时候我们使用印刷机来出来文字.印刷出来的每个字,都位于独立的一个块中. 行间距,即传说中控制两行文字垂直距离的东东.在CSS中,line-height被用来控制行与行之间垂直距离. 不过,行间距与半行间距,还是取决于CSS中的line-height.那么,如何来使用line-height呢? 默认状态,浏览器使用1.0-1.2 line-

XE6 c++builder 设置 font size GetPropInfo SetOrdProp

TObject* objTemp; objTemp = GetObjectProperty(this, "Font"); if (objTemp) { PPropInfo ppi; ppi = GetPropInfo(objTemp->ClassType(), "Size"); if (ppi && (*ppi->PropType)->Kind == tkInteger) SetOrdProp(objTemp, ppi, 12);

【CSS中width、height的默认值】

对于初学者来说,CSS中的width.height的默认值是很神奇的,因为经常看到如下这样的代码:明明只给一个#father标签(红色的div)设置了一个width,为啥它在浏览器中显示出来是有一个固定的height的呢. <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>测试宽度</title> <style type="tex

[Android Tips] 9. framework notification layout font size

android 4.4 framework notification layout 相关字体大小 * title: notification_title_text_size: 18dp * content: notification_text_size: 14dp * subtext: notification_subtext_size: 12dp [Android Tips] 9. framework notification layout font size

UIAlertController custom font, size, color

本文转载至 http://stackoverflow.com/questions/26460706/uialertcontroller-custom-font-size-color up vote2down votefavorite 3 I am using new UIAlertController for showing alerts. I have this code: // nil titles break alert interface on iOS 8.0, so we'll be