Home  >  Article  >  Web Front-end  >  Abbreviation of font in css

Abbreviation of font in css

墨辰丷
墨辰丷Original
2018-05-09 17:58:301781browse

This article will introduce the abbreviation of font in CSS in detail. Interested friends can refer to it.

The example code is as follows:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"  
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<style> 
    .login_top{height:26px;font:bold 14px/26px "宋体"; border:1px solid #000} 
    .login_top2{height:26px; line-height:26px; font-weight:bold;font-size:14px;border:1px  
solid #000;  font-family:&#39;宋体&#39;} 
</style> 
<div class="login_top">我垂直不居中</div> 
<br/ > 
<div class="login_top2">我垂直居中</div>

Summary:

1. When abbreviated, font- Size and line-height can only be composed of one value through slash/ and cannot be written separately.

2. The order cannot be changed. This shorthand method only works when the font-size and font-family attributes are specified at the same time. Moreover, if you do not set font-weight, font-style, and font-variant, they will use the default values

Related recommendations:

How js matches and calculates font-size

How the font-size-adjust attribute optimizes web page layout

font-weight: how to deal with blod beating

css3 font variant font-variation detailed explanation


The above is the detailed content of Abbreviation of font in css. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn