Overflow attribute usage of CSS

Source: Internet
Author: User

The overflow attribute of CSS has four values: visible (Default), hidden, scroll, and auto. Similarly there are two overflow sisters attributes Overflow-y and overflow-x, which are rarely used. Let's take a look at each of these values and discuss common usage and techniques.

Auto

Overflow's auto value is much like scroll, and it only solves the problem of scroll bars when you don't need them.

Hidden

The opposite value of the default value visible is hidden. It hides all the content that goes beyond the box. This is useful for coping with dynamic content and may cause some layout problems due to content overflow. However, keep in mind that the hidden content of this method will not be completely visible (unless you view the source code). For example, some users set their browser's default font larger than you expected, you will put some text to the outside of the box and then completely hidden ...

Visible

If you do not set the overflow property, the default overflow property value is visible. So in general, there's no reason to specifically set the overflow attribute to visible unless you want to overwrite the value it has set elsewhere. The important thing to remember here is that although the contents outside the box are visible, the content does not affect the workflow of the page. In general, you don't have to set a fixed height for the contents of a text box, so you don't have to do this.

Scroll

Setting the overflow value of a box to scroll will hide what is rendered outside the box, but it will provide a scroll bar to scroll inside the box to see what remains. It is worth noting that using scroll will produce both horizontal and vertical two scroll bars, even if the content requires only one of them.

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.