How to use css page-break-before attribute

青灯夜游
Release: 2019-05-29 14:47:46
Original
2799 people have browsed it

css page-break-before attribute is used to add a page break before the specified element. Note that this attribute cannot be used on absolutely positioned elements, and should also be avoided in tables, floating elements, and block elements with borders. All browsers support the page-break-before attribute.

How to use css page-break-before attribute

How to use the css page-break-before attribute?

The page-break-before property adds a page break before the specified element.

Note: Although you can use always to force page breaks, there is no guarantee that the insertion of page breaks will be avoided. The most the creator can do is ask the user agent to avoid inserting page breaks as much as possible. Applies to: non-floating block-level elements whose position value is relative or static.

Note: All major browsers support the page-break-before attribute. The property values ​​"left", "right", and "inherit" are not supported in any version of Internet Explorer (including IE8). Firefox, Chrome, and Safari do not support the attribute values ​​"avoid", "left", and "right".

css page-break-before attribute Example

Always insert a page break before the

element:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"> 
<style>
@media print {
    h1 {page-break-before: always;}
}
</style>
</head>
<body>
....
</body>
</html>
Copy after login

The above is the detailed content of How to use css page-break-before attribute. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
css
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template