

It indicates that content is not clipped, i.e., it may be rendered outside the left and/or right edges of the element and may overlap other elements next to it. Of course, the height of the element is also explicitly set, otherwise it would normally just expand to fit the content inside it vertically, and no overflow would occur. The result of applying the four overflow-x values to an element which has horizontally overflowing content and vertically overflowing content. This is because the computed values of overflow-x and overflow-y are the same as their specified values, except that some combinations with visible are not possible, so the values are recomputed as specified in the above two points.
#Overflow x how to#
The overflow-x property only specifies how to treat overflow content that overflows the element horizontally. Refer to the overflow property entry for more information. The overflow-x property has been introduced in CSS3 as one of two long-hand property for the shorthand property overflow, which can be used to set the values of both the overflow-x property and the overflow-y property.


These values are still experimental and have no current ( February 2014) browser support. In CSS3, new overflow values have been added: no-display and no-content. Since there is horizontal overflow, the scroll bar is added. The result of applying overflow-x: scroll and overflow-x: auto is the same in this case because scroll will add the scroll bar whether it’s needed or not, and auto leaves it up to the browser to choose whether to add them or not depending on whether there is horizontal overflow or not. The result of applying the four overflow-x values to an element whose content (image) overflows on the right edge. The overflow-x property can take one of four possible values: visible (which is the default value), hidden (which clips the content outside the boundaries of the element), scroll (which adds a horizontal scroll bar to the element whether or not it needs it), and auto (which leaves it up to the browser to decide whether or not to add scroll bars as necessary). The overflow-x property can be used to show the overflow content on the left and right edge, clip it (hide any excess content that’s outside the element’s boundaries), or add horizontal scroll bars to the element so that the overflow content can be seen on scroll. The content overflows an element horizontally when the element has a specified width, and it contains content inside it that has a width that is larger than the width of the element itself.įor example, an element may have overflow content if it has an explicitly set width, and contains an image whose width is larger than the width of the element, so the image extends outside the left and/or right boundaries of the element. The overflow-x property is used to specify whether the content of an element should be visible, clipped (hidden), or whether or not to add horizontal scroll bars when the content overflows the element’s left and right edges.
