Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Content Overflow | Item Positioning
course content

Course Content

Advanced CSS Techniques

Content OverflowContent Overflow

Let's consider how we can control the content overflow with the help of one property. Sometimes happens that we have the fixed width and height of the element. However, the inner content is much bigger than the available space. The overflow property controls the behavior of an element's content when it exceeds the height or width values explicitly set for the element.

  • visible - is the default value. The content overflows the element borders and stays visible;
  • scroll - The content overflows the element borders, and the scrollbar appears that allows a user to scroll both vertically and horizontally;
  • hidden - The content that overflows the element borders size is cut and not visible;
  • auto - works the same as scroll. However, the scrollbars appear only when the content overflows the element borders.

Note

The overflowing content does not affect the other elements' geometry.

visible

If the overflow property is not set, its default value is visible. It means that the content will be displayed outside the element's borders. In the example, the box's borders are highlighted in darkblue, and the box has fixed width and height properties.

html

index.html

css

index.css

js

index.js

scroll

We can see the full element content using a scroll. Let's check the example:

html

index.html

css

index.css

js

index.js

hidden

All overflow content will be hidden, and a user will never see it. Generally, it is helpful only when we need to develop some decorative effects.

html

index.html

css

index.css

js

index.js

What does the overflow property do?

Select the correct answer

Everything was clear?

Section 2. Chapter 12
course content

Course Content

Advanced CSS Techniques

Content OverflowContent Overflow

Let's consider how we can control the content overflow with the help of one property. Sometimes happens that we have the fixed width and height of the element. However, the inner content is much bigger than the available space. The overflow property controls the behavior of an element's content when it exceeds the height or width values explicitly set for the element.

  • visible - is the default value. The content overflows the element borders and stays visible;
  • scroll - The content overflows the element borders, and the scrollbar appears that allows a user to scroll both vertically and horizontally;
  • hidden - The content that overflows the element borders size is cut and not visible;
  • auto - works the same as scroll. However, the scrollbars appear only when the content overflows the element borders.

Note

The overflowing content does not affect the other elements' geometry.

visible

If the overflow property is not set, its default value is visible. It means that the content will be displayed outside the element's borders. In the example, the box's borders are highlighted in darkblue, and the box has fixed width and height properties.

html

index.html

css

index.css

js

index.js

scroll

We can see the full element content using a scroll. Let's check the example:

html

index.html

css

index.css

js

index.js

hidden

All overflow content will be hidden, and a user will never see it. Generally, it is helpful only when we need to develop some decorative effects.

html

index.html

css

index.css

js

index.js

What does the overflow property do?

Select the correct answer

Everything was clear?

Section 2. Chapter 12
some-alt