CSS lets text not exceed Div's fixed width and height

Source: Internet
Author: User

In the production of div+css page we often encounter text beyond the fixed height also called content overflow, wait until we finish the entire page when the content added, found that some local text beyond the border content overflow, and even text run out of CSS set border line, the following figure:

First we set the class like this:. STYLE1 {width:150px height:80px;color: #000000; border:1px solid #FF0000}, and the text we do not know how many words we need to just do not exceed the set red border, Results text or pictures larger than the Set box (CSS box) high and wide.

Resolve to keep text beyond the fixed height of the CSS box we just need to add the Overflow:hidden style to this CSS class, and then add the CSS class:. STYLE1 {width:150px; Height:80px;color: #000000; border:1px solid #FF0000; overflow:hidden;} The effect is the following figure:

This way the text will not overflow beyond the set fixed high and wide areas.

Description

Overflow is to retrieve or set how content is managed when the content of the object exceeds its specified height and width.

Overflow syntax:

overflow:visible | Auto | Hidden | Scroll

Overflow parameters:

Visible: Do not cut content nor add scroll bars. If you explicitly declare this default value, the object will be clipped to the size of the window or frame that contains the object. and the Clip property setting will fail

Auto: This is the default value for the body object and textarea. Cut content and add scroll bars when needed

Hidden: Do not display content that exceeds the object size

Scroll: Always show scroll bars

Related Article

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.