html5 Site Icon CSS3 Site Icon CSS Site Icon

CSS 1/2 Reference

CSS widows property

Definition

The CSS widows property allows us to specify the minimum number of lines to display at the top of the next page, when a page break occurs inside a block-level element.

Applies To

All block-level elements.

Property Values

negative values are NOT acceptable when using the CSS widows property.

inherit - Widow attributes are inherited from the parent element.

integer - Defines the number of lines of a block container that must be shifted to the next printable page.

Default Value

Default value is set to 2.

Inheritance

The widows properties are inherited from the parent element if none are applied to the current element.

Browser Anomalies

Only IE8 and above and Opera support the CSS widows property.
IE5, IE6 and IE7 do not support the inherit property value.
IE8 does with a valid !DOCTYPE.
IE9+ supports the inherit property value.

Example



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"  
         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
<!-- Our HTML/CSS for the CSS orphans property follows -->
<html  xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>CSS 1/2 Reference - CSS widows Property</title>

<!-- Valid values for CSS widows Property are:
	
	inherit and integer. 
	
--> 

<style type="text/css">

/* Deal with paragraph widows */
p {
  widows; 5;
}
</style>
</head>

<body>
<h1>The widows CSS property</h1>
<p>Some text you need to repeat if you wanna test this property</p>
</body>
</html>
CSS white-space    << Prev          Next >>   CSS width

go to home page Homepage go to top of page Top