


Normal - Lines only break at unforced breakpoints, like the space between two words.The overflow-wrap property can be defined with one of three values. A string of text that is too long to fit within the line box would be unbreakable without this attribute, resulting in overflow. The overflow-wrap property in CSS is used to tell the browser when it can divide a line of text into multiple lines. Vertical overflow, or overflow from the top and bottom of an element's box, is controlled by the overflow-y property. Horizontal overflow, or overflow from the left and right of an element's box, is controlled by the overflow-x attribute. In the example below, the first div has overflow and, therefore, a scrollbar, and the second div does not. Meaning the box has a scrollable overflow. Overflow:auto means that the overflow will be clipped at the box's padding edge, and a scroll bar will be added if necessary. However, only one has a scrollable overflow and a scrollbar. The "auto" setting is similar to scroll, but it only adds a scrollbar when the box exceeds its maximum size.īoth divs in the example below are set to overflow:auto. In the example below, a scrollbar is added. Overflow:scroll means that the overflow will be clipped at the box's padding edge, but a scrolling mechanism will be added so that users will be able to scroll to see the content that isn't visible. On the other hand, a scrollbar or panner will be introduced so that viewers can scroll to see content that isn't visible. The overflow will be trimmed at the padding border of the box. Set the overflow property to "scroll" to prevent overflow from rendering outside the element's box while allowing users to access the content. This value differs from "clip" in that it still allows programmatic scrolling, which means the box is technically a scroll container. Instead, it will be clipped at the box's padding edge. Overflow:hidden means that the overflow will not render outside the element’s box. This will clip the content at the padding edge of the box and prevent the user from scrolling or dragging their finger on a touch screen or using any other method to access the information beyond that edge. Set the overflow property to "hidden" to prevent overflow from rendering outside the element's box. It includes a simple technique for formatting and editing web page content. We did it just for the sake of this demo.ĬSS aids us in describing the appearance of our web page written in markup languages such as HTML and XML. Since the CSS overflow property is set to visible by default, we don't have to define it in your CSS. Overflow:visible means that the overflow will render outside the element’s box and potentially overlap with other elements on the page, as shown below. Unless we are overriding CSS in an external stylesheet or elsewhere on our site, we don't need to set the CSS overflow property to "visible." Example: CSS Code: The CSS overflow property is set to visible by default.

Instead, it will render outside of the element's box, and it will overlap with other page components. The overflow will not be trimmed if it is visible. Now, let us see all the properties in detail. auto - Similar to scroll, but it adds scrollbars only when necessary.scroll - The overflow is clipped, and a scrollbar is added to see the rest of the content.hidden - The overflow is clipped, and the rest of the content will be invisible.The content renders outside the element's box To do so, we need to use the properties mentioned below. We have three options: allowing the content to render beyond the element's box, clipping the content, or clipping the content and adding a scrollbar. There are a few options for regulating overflow with the CSS overflow attribute. We can use CSS to modify the background image, background color, display color, images, fonts, text size, spacing between the text, text layering, different layouts for different devices, and web page modification for different screen sizes.ĬSS aids us in describing the appearance of our web page written in markup languages such as HTML and XML. CSS is a style sheet language that is used to create web page layouts and styles. CSS is an acronym for Cascading Style Sheets.
