Home  >  Article  >  Web Front-end  >  What is font in css style

What is font in css style

WBOY
WBOYOriginal
2022-06-06 16:45:493325browse

In CSS, font is an abbreviated attribute used to declare all font attributes; this attribute can specify font style, variant, thickness, size and line height, and font series in order. Unset attributes will Using its default value, the syntax is "element {font: font style specified in order;}".

What is font in css style

The operating environment of this tutorial: Windows 10 system, CSS3&&HTML5 version, Dell G3 computer.

css style font

font shorthand property sets all font properties in one declaration.

This attribute also has a sixth value: "line-height", which can set the line spacing.

Description

This shorthand property is used to set two or more aspects of an element's font at once. Use keywords such as icon to appropriately set the font of an element to match an aspect of the user's computer environment. Note that if these keywords are not used, at least the font size and font family must be specified.

You can set the following properties in order:

  • font-style

  • ##font-variant

  • font-weight

  • font-size/line-height

  • ##font-family
  • You can not set one of the values, such as font:100% verdana; is also allowed. Properties that are not set use their default values.

The example is as follows:

<html>
<head>
<style type="text/css">
p.ex1
{
font:italic arial,sans-serif;
}
p.ex2
{
font:italic bold 12px/30px arial,sans-serif;
}
</style>
</head>
<body>
<p class="ex1">This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph.</p>
<p class="ex2">This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph.</p>
</body>
</html>

Output result:

##(Learning video sharing: What is font in css stylecss video tutorial

The above is the detailed content of What is font in css style. 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