CSS overflowy Property (original) (raw)

CSS overflow-y Property

Last Updated : 30 Jun, 2022

The overflow-y property of CSS specifies the behavior of content when it overflows a block-level element's top and bottom edges. The content may be clipped, hidden or a scrollbar may be displayed accordingly based on the value assigned to the overflow-y property.

Syntax:

overflow-y: scroll | hidden | visible | auto

Property values:

Example:

html `

CSS overflow-y Property

The overflow-y Property

<!-- Below paragraph doesnot have a fixed width
     or height and has no overflow set. So, it 
     will just take up the complete width of 
     it's parent to fit the content -->
<p>
    The CSS overflow-y property specifies the
    behavior of content when it overflows a 
    block-level element’s top and bottom edges.
    The content may be clipped, hidden or a 
    scrollbar may be displayed as specified.
</p>


<h2>overflow-y: scroll</h2>
<!-- Below div element has fixed height and 
     width and thus overflow may occur. -->
<div class="content">
    GeeksforGeeks is a computer science portal 
    with a huge variety of well written and 
    explained computer science and programming
    articles,quizzes and interview questions.
    The portal also has dedicated GATE preparation
    and competitive  programming sections.
</div>

`

Output:

overflow-y: scroll

Example:

html `

CSS overflow-y Property

The overflow-y Property

<!-- Below paragraph doesnot have a fixed width
     or height and has no overflow set. So, it 
     will just take up the complete width of 
     it's parent to fit the content -->
<p>
    The CSS overflow-y property specifies the
    behavior of content when it overflows a 
    block-level element’s top and bottom edges.
    The content may be clipped, hidden or a 
    scrollbar may be displayed as specified.
</p>


<h2>overflow-y: scroll</h2>
<!-- Below div element has fixed height and 
     width and thus overflow may occur. -->
<div class="content">
    GeeksforGeeks is a computer science portal 
    with a huge variety of well written and 
    explained computer science and programming
    articles,quizzes and interview questions.
    The portal also has dedicated GATE preparation
    and competitive  programming sections.
</div>

`

Output:

overflow-y: hidden

Example:

html `

CSS overflow-y Property

The overflow-y Property

<!-- Below paragraph doesnot have a fixed width
     or height and has no overflow set. So, it 
     will just take up the complete width of 
     it's parent to fit the content -->
<p>
    The CSS overflow-y property specifies the
    behavior of content when it overflows a 
    block-level element’s top and bottom edges.
    The content may be clipped, hidden or a 
    scrollbar may be displayed as specified.
</p>


<h2>overflow-y: scroll</h2>
<!-- Below div element has fixed height and 
     width and thus overflow may occur. -->
<div class="content">
    GeeksforGeeks is a computer science portal 
    with a huge variety of well written and 
    explained computer science and programming
    articles,quizzes and interview questions.
    The portal also has dedicated GATE preparation
    and competitive  programming sections.
</div>

`

Output:

overflow-y: visible

Example:

html `

CSS overflow-y Property

The overflow-y Property

<!-- Below paragraph doesnot have a fixed width
     or height and has no overflow set. So, it 
     will just take up the complete width of 
     it's parent to fit the content -->
<p>
    The CSS overflow-y property specifies the
    behavior of content when it overflows a 
    block-level element’s top and bottom edges.
    The content may be clipped, hidden or a 
    scrollbar may be displayed as specified.
</p>


<h2>overflow-y: scroll</h2>
<!-- Below div element has fixed height and 
     width and thus overflow may occur. -->
<div class="content">
    GeeksforGeeks is a computer science portal 
    with a huge variety of well written and 
    explained computer science and programming
    articles,quizzes and interview questions.
    The portal also has dedicated GATE preparation
    and competitive  programming sections.
</div>

`

Output:

overflow-y: auto

Supported Browsers: The browser supported by overflow-y property are listed below: