1. Overflow Overflow is overflow (container). When the content exceeds the container, just add the overflow attribute value to hidden to hide the part that exceeds the container. If the content exceeds the container but you don't want it to be hidden, you can set its property value to auto; overflow: auto attribute If the value exceeds the limit, a scroll bar will appear; if the value does not exceed the limit, no scroll bar will appear. The scroll bar can also be set individually, for example overflow-x: hidden; overflow-y: auto; so that only the vertical scroll bar is visible. If you define the x-axis or y-axis separately, you need to set the attribute values for both attributes. Original effect: Add overflow: hidden; attribute, effect: As you can see, overflow:hidden will hide the part that exceeds the box, which can also be understood as cutting off. 2. Add overflow-x: hidden; overflow-y: auto properties The properties are set to overflow-x: auto; overflow-y: hidden; the effect is exactly the opposite of the above picture, that is, the side of the scroll bar is hidden and appears at the bottom. 2. Common attribute values of overflow There are four common overflow attributes: visible, hidden, auto and scroll; Visible is the default value of overflow, which means it exceeds the display. Hidden means beyond hidden; auto is automatic, that is, a scroll bar will appear if the value exceeds the limit, and no scroll bar will appear if the value does not exceed the limit. The content will be trimmed if scroll is set, but the browser will display a scroll bar to view the remaining content. 3. Magical usage of overflow The first usage: Solve the margin-top transmission problem Margin-top transmission problem: The margin-top of the child element will bring down the parent element together. This can be solved by adding overflow:hidden to the parent element The second usage: Clear the impact of floating --- collapse the height of the parent element Universal cleaning method overflow:hidden clear:both The third usage: reveal animation --- beyond hiding Fourth usage: single-line text exceeds ellipsis .sl{ white-space:nowrap;/*no line break*/ overflow:hidden;/*Exceeding hidden*/ text-overflow:ellipsis;/*exceeds ellipsis*/ width:; } Note that you need to set the width The above is a detailed explanation of the CSS3: overflow property. For more information about the CSS3 overflow property, please pay attention to other related articles on 123WORDPRESS.COM! |
<<: This article will help you thoroughly understand the specific use of cgroup in Docker
>>: Sharing of research experience on using characters instead of rounded corners and sharp corners
Table of contents Code Optimization Using key in ...
The key is that the local server does not have wr...
Preface You may often receive warning emails from...
This is the style recommendation given by the W3C ...
Tips for viewing History records and adding times...
Table of contents 1. Baidu Map API Access 2. Usin...
This article shares the specific code of native j...
First of all, I don't know why I can't lo...
background A few days ago, when I was doing pagin...
Table of contents 1. Routing and page jump 2. Int...
Table of contents 1.parseInt(string, radix) 2. Nu...
Table of contents Method 1: Call the function dir...
Pre-installation work: Make sure vmware workstati...
Preface Linux does not have a prominent Recycle B...
{ {}} Get the value, the original content of the ...