CSS Content Overflow Properties
The overflow-wrap property in CSS can be defined as it allows you to specify that the browser can break (overflow content)a line of text inside the container or targeted element onto multiple lines (more than one line) in an otherwise unbreakable place.
This overflow-wrap property helps in CSS to avoid an unusually long string of text causing layout problems due to overflow.
when you write the content in web pages you have a lot of content in a parent element which has a limited width or height means that container or section have limited width and height.
Therefore, by default, In the web pages, the content will visible outside of the parent element’s bounds (content visible outside the container). With the overflow property,
how to handle that overflowing content Case.
Apply the four overflow properties of:
Visible: Used as a default
Hidden: hidden value is used for the clip of the content.
Scroll: scroll value is used for always display scrollbars.
Auto: auto value is used for the displays scrollbars if content overflows.
CSS Syntax used
|
1 |
overflow-wrap: normal|break-word|hyphens|inherit|hidden; |
|
1 2 3 |
#element { overflow-x: hidden; } |
|
1 2 3 |
#element { overflow-y: hidden; } |
It can be displayed, clipped, an ellipsis (‘…’), or display a custom string.
Text-Overflow CSS Syntax
|
1 |
text-overflow: clip | ellipsis | "_" | ""; |
|
1 2 3 4 |
#element{ overflow: hidden; white-space: nowrap; } |
Why Content overflow problem occurs due to the following reasons?
1. first thing is that the height of the container may be fixed, then in this situation, you may set the height to auto or
you may use min-height;
2. Second thing is that If you want fixed height then in this situation you may set the overflow to scroll or hide.
3. otherwise check the padding, margin and set the width properly.