Home >Web Front-end >CSS Tutorial >Briefly introduce the use of page-break-after attribute

Briefly introduce the use of page-break-after attribute

黄舟
黄舟Original
2017-07-08 09:40:202465browse

In the previous course, the editor introduced many commonly used cssproperties. Today I want to change the route and introduce to you a relatively unpopular attribute - page-break-after. Although the usage rate of this attribute is quite low, it may be useful to you under certain circumstances. Help!

The page-break-after attribute is quite unfamiliar to many CSS learners. The editor also saw this attribute by chance. This attribute is mainly used to control the printing page in the B/S program. But in practice, CSS has relatively poor control capabilities in this area. For example, automatic pagination has basically no practical use. We usually need to force the browser to paginate when needed.

Briefly introduce the use of page-break-after attribute

Having said that, let’s first take a look at the attribute values ​​​​of page-break-after and their uses! Its attribute values ​​include: auto, always, avoid, left, right and inherit.

Auto: Has no effect on page splitting.

Always: Force the page separator to appear after the element.

Avoid: Avoid page separators appearing after elements.

Left: Inserts a page break after the element until it reaches a blank left margin.

Right: Inserts a page break after the element until it reaches a blank right margin.

Inherit: Use the same attribute value as the parent element.

After understanding its attribute values, if we want to print pages on the web, we can just insert tags where page breaks are needed.

For example:

Briefly introduce the use of page-break-after attribute

## Let me remind you: using page-break-after on Firefox has no effect. This is because Firefox cannot The table is disconnected. The solution is not to put the printed content in a table, but in a DIV.

Having said so much, some people may still feel that it is of no use to them. This is understandable. After all, technology is very abstract. If you don’t use it, you won’t know its importance. So let me give you an example, everyone is familiar with Angong Niuhuang Pill. When an elderly person at home suffers a stroke, using it for first aid can buy enough time to send the patient to the hospital for further treatment. Its importance is self-evident. The same goes for page-break-after. Although it may not be used normally, it can come in handy when you suddenly encounter urgent printing needs.

The above is the detailed content of Briefly introduce the use of page-break-after attribute. 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