CSS overflow white-space CSS3 text-overflow Properties

Source: Internet
Author: User

The following properties can be used when the contents of the div are out of size and are prompted with the title property of the div to display content that is not displayed when the mouse is placed over it

CSS Reference Manuals

Instance

To set the overflow property:

Div  {  width:150px;  height:150px;  overflow:scroll;  }

Try it yourself.

Browser support

All major browsers support the overflow property.

Note: The property value "Inherit" is not supported by any version of Internet Explorer (including IE8).

Definition and usage

The overflow property specifies what happens when the content overflows the element box.

Description

This property defines how the content of the overflow element's content area will be handled. If the value is scroll, the user agent provides a scrolling mechanism, whether or not it is required. Therefore, it is possible that scroll bars appear even if all the contents of the element box can be dropped.

Default value: Visible
Inheritance: No
Version: CSS2
JavaScript Syntax: object. style.overflow= "Scroll"
Possible values
value Description
Visible The default value. The content is not trimmed and is rendered outside the element box.
Hidden The content is trimmed and the rest is not visible.
Scroll The content is trimmed, but the browser displays scroll bars to see the rest of the content.
Auto If the content is trimmed, the browser displays scroll bars to see the rest of the content.
Inherit Specifies that the value of the overflow property should be inherited from the parent element.
Tiy instances
How to use scroll bars to display content that overflows within an element
This example shows how to set an overflow property to specify a corresponding action when the element content is too large to exceed the specified area.
How to hide overflow content in overflow elements
This example shows how to set the overflow property to hide its contents when the content in the element is too large to fit within the specified range.
How to set up a browser to handle overflow automatically
This example shows how to set up a browser to handle overflows automatically.
Related pages

CSS Tutorial: CSS Positioning

HTML DOM Reference manual: Overflow properties

CSS Reference Manuals

CSS Reference Manuals

Definition and usage

The White-space property sets how to handle whitespace within an element.

This property declares how to handle whitespace in elements during layout creation. The values Pre-wrap and Pre-line are new in CSS 2.1.

Default value: Normal
Inheritance: Yes
Version: CSS1
JavaScript Syntax: object. style.whitespace= "Pre"
Instance

Text in a specified paragraph does not wrap:

P  {  white-space: nowrap  }

Tiy

Browser support

All browsers support the White-space property.

Note: The property value "Inherit" is not supported by any version of Internet Explorer (including IE8).

Possible values
value Description
Normal Default. The blank will be ignored by the browser.
Pre The blank will be reserved by the browser. It behaves like a <pre> tag in HTML.
NoWrap The text does not wrap, and the text continues on the same line until the <br> tag is encountered.
Pre-wrap Preserves the sequence of whitespace characters, but wraps them normally.
Pre-line Merges a sequence of whitespace characters, but preserves newline characters.
Inherit Specifies that the value of the White-space property should be inherited from the parent element.
Tiy instances
Suppress text wrapping in an element
This example shows how to suppress the wrapping of text in an element.
Related pages

CSS Tutorial: CSS text

HTML DOM Reference manual: Whitespace properties

CSS Reference Manuals

CSS Reference Manuals

Instance

Use the Text-overflow property:

Div.test{text-overflow:ellipsis;}

Try it yourself.

There are more instances at the bottom of the page.

Browser support
IE Firefox Chrome Safari Opera

All major browsers support the Text-overflow property.

Definition and usage

The Text-overflow property specifies what happens when the text overflows the containing element.

Default value: Clip
Inheritance: No
Version: CSS3
JavaScript Syntax: object. style.textoverflow= "Ellipsis"
Grammar
text-overflow:clip|ellipsis| string;
value Description Test
Clip Trims the text. Test
Ellipsis Displays the ellipsis to represent the trimmed text. Test
String Uses the given string to represent the trimmed text.
Try it yourself-example
Text-overflow with hover effect
This example shows how to display all the text when the cursor floats over the element.
Related pages

CSS3 Tutorial: CSS3 text effects

CSS Reference Manuals

CSS overflow white-space CSS3 text-overflow Properties

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.