If the content is larger than the maximum width, it will automatically change the height of the element. If the content is smaller than the maximum width, the Note: This prevents the value of the width property from becoming larger than Default value:noneInherited:noAnimatable:yes, see individual properties. Read about animatable Try itVersion:CSS2JavaScript syntax:object.style.maxWidth="600px" Try it The widows property sets or returns the minimum number of lines for an element that must be visible at the top of a page (for printing or print preview). The widows property only affects block-level elements. Tip: widows:5 means that at least 5 lines must be visible below the page break. Tip: See the orphans property to set or return the minimum number of lines for an element that must be visible at the bottom of a page. While CSS has many options for controlling the Remnants & Fragments“Widows” and “orphans” refer to a word or line of text that is laid out on the page in a way that disturbs reading flow and the “look” of the page: most commonly, words that are left dangling at the end of paragraphs. In paginated media, this is commonly seen as end-of-paragraph words that fall onto the next page: Example of a printed widowBrowser’s don’t have a concept of “pages” for the screen, but widows can come up when a site is printed, and should be controlled for:
This translates to “if a paragraph breaks to the next printed page, the remnant must consist of at least three lines.” A browser that supports the property will space elements in such a way as to make that happen: Printed pages with solved widows“Orphans”, on the other hand, occur at the start of text blocks. The most common example is a paragraph that starts at the bottom of a page: An example of orphaned textAgain, it can be controlled with by setting the
Meaning: a paragraph must start with at least three lines on a page before it can be broken; otherwise, the paragraph should start on a new page. The result: An example of solved orphaned textSuggested UseBoth
While elements like headings can also have dangling or leading fragments, it’s more common to treat then with An easy (if somewhat Dickensian) way to remember the terms:
Widows & Orphans on ScreenBy its very nature, responsive design creates innumerable fragments of widowed text. Some of these can be treated by intelligent use of hyphens and justification, but others are simply unavoidable. Many resources will tell you that The prefix-free CSS, together with a solution for orphaned text:
Result: Orphaned text solved in columnsI assume that this same ability will be applied to CSS Regions, once the spec is fully supported in browsers. Single-Line FitsThe most egregious case of text widows occur in headings, where terminating words are often left dangling on a new line. There are solutions for this: FitText is a JQuery plugin that resizes text dynamically as the browser resizes; Chris Coyier’s technique inserts non-breaking spaces, and there are also SVG solutions. My personal preference is to use 3 units to fit heading text on a single line, although this often requires some calculation and experimentation; I hope to create a “FitterText” script in the near future that can apply the correct 3 measurement once to text elements, with no recalculation-on-viewport-resize required.Browser SupportSupport for |