The use and definition of CSS White-space properties

Source: Internet
Author: User
The White-space property of the CSS is used to specify how to handle white space characters in the container, such as: space (), newline (\ n), indentation (\ t), and so on.

White-space from CSS1, applicable to block elements, with inheritance, support IE 5.5+, Chrome, FireFox, Safari, opera and other mainstream browsers, the default value is normal.

Grammar:

White-space:normal | Pre | NoWrap

Parameters:

Normal: Default processing mode
Pre: Displays preformatted text in equal-width font. Do not combine whitespace distances between words and justify them. See Pre objects
NoWrap: Forces the display of all text within the same line until the text ends or encounters a BR object. See NoWrap Properties (attributes) for objects such as Td,div

Description

Sets or retrieves how spaces within an object are handled.
The corresponding script attribute is whitespace. Please refer to the other bibliography I have written.

Example:

p {white-space:nowrap;}


Description

White-space supports normal, pre, nowrap, Pre-wrap, Pre-line, inherit equivalents. Let's take a detailed description of the differences between these values.

JavaScript operations

White-space the corresponding property name in JavaScript is whitespace, for example:

document.getElementById ("P1"). Style.whitespace = "nowrap";

The whitespace property on the Style object is read-write, but the whitespace property on the Currentstyle object is read-only.

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.