Home >Web Front-end >CSS Tutorial >How to use the overflow-x attribute
The overflow-x attribute is used to specify whether to crop the left/right edge of the content when the element overflows the content area.
CSS3 overflow-x attribute
Function:overflow-x attribute Specifies whether to clip the left/right edges of the content - if it overflows the element's content area.
Tip: Use the overflow-y property to determine whether the top and bottom edges are clipped.
Syntax:
overflow-x: 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: overflow-x attribute does not work correctly in IE8 and earlier browsers.
CSS3 Overflow-x 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:
The above is the detailed content of How to use the overflow-x attribute. For more information, please follow other related articles on the PHP Chinese website!