Home >Web Front-end >CSS Tutorial >Does Border-Radius Clip Content?
When applying border-radius to a container, the content within it may unexpectedly extend beyond its edges. This observation raises the question: should the content be clipped within the rounded borders?
To understand the expected behavior, we delve into the specifications of CSS. The default overflow property for elements, including divs, is set to "visible," indicating that content will not be clipped and may extend outside the block box.
Additionally, the Backgrounds and Borders module specifies that "other effects that clip to the border or padding edge (such as ‘overflow’ other than ‘visible’) also must clip to the curve." This means that for the rounded corners to clip the content, the overflow value of the container must be set to something other than "visible."
Therefore, as surprising as it may seem, it is expected behavior that content is not clipped within rounded borders unless the container has an overflow value of "hidden" or other non-visible values. This behavior ensures that content is not truncated when the container has visible overflow.
The above is the detailed content of Does Border-Radius Clip Content?. For more information, please follow other related articles on the PHP Chinese website!