Home  >  Article  >  Web Front-end  >  How to use the overflow-y attribute

How to use the overflow-y attribute

青灯夜游
青灯夜游Original
2019-02-12 15:45:235773browse

The overflow-y attribute is used to specify whether to crop the top/bottom edge of the content when the element overflows the content area.

How to use the overflow-y attribute

CSS3 overflow-y attribute

Function:overflow-y attribute Specifies whether top/bottom edge content should be clipped if it overflows the element's content area.

Tips: Use the overflow-x attribute to determine whether the left and right edges are cropped.

Syntax:

overflow-y: visible|hidden|scroll|auto|no-display|no-content;

visible: The content is not cropped and may be displayed outside the content box.

hidden: Cropped content - no scrolling mechanism provided.

scroll: Crop content - Provides scrolling mechanism.

auto: A scrolling mechanism should be provided if the box overflows.

no-display: If the content does not fit into the content box, remove the entire box.

no-content: Hide the entire content if it does not fit into the content box.

Note: All major browsers support the overflow-y attribute; but it does not work correctly in IE8 and earlier browsers.

CSS3 Overflow-y attribute usage example

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<style> 
div
{
width:110px;
height:110px;
border:thin solid black;
overflow-x:hidden;
overflow-y:hidden;
}
</style>
</head>
<body>
<div><p style="width:140px">
这是一个段落。这是一个段落。这是一个段落。这是一个段落。
这是一个段落。这是一个段落。这是一个段落。这是一个段落。
这是一个段落。这是一个段落。这是一个段落。这是一个段落。
这是一个段落。这是一个段落。这是一个段落。这是一个段落。
这是一个段落。这是一个段落。这是一个段落。这是一个段落。
</p></div>
<p>Overflow-x 是否对内容的左/右边缘进行裁剪。</p>
<p>Overflow-y 是否对内容的上/下边缘进行裁剪。</p>
</body>
</html>

Rendering:

How to use the overflow-y attribute

The above is the detailed content of How to use the overflow-y attribute. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn