🔥Limited Offer: Get 50% OFFon AI & Full Stack Courses🔥
Back to CSS Notes
Topic #74

Overflow X and Y


Overflow in Specific Directions

The overflow-x and overflow-y properties allow you to control overflow behavior independently for horizontal and vertical directions.


CSS overflow-x and overflow-y

The overflow-x and overflow-y properties specifies whether to change the overflow of content just horizontally or vertically (or both):

  • overflow-x specifies what to do with the left/right edges of the content.
  • overflow-y specifies what to do with the top/bottom edges of the content.

Example

div {
  overflow-x: hidden; /* Hide horizontal scrollbar
*/
  overflow-y: scroll; /* Add vertical scrollbar */
}

Common Use Cases

These properties are useful when you need different scroll behavior for horizontal and vertical content:

  • Horizontal scrolling table - Use overflow-x: auto for wide tables
  • Chat windows - Use overflow-y: scroll for vertical message scrolling
  • Code blocks - Use overflow-x: auto to handle long lines

Example

div {
  overflow-x: scroll;
  overflow-y: hidden;
}

Want to go beyond the notes?

Join CodingNow 2.0's CSS course — live mentorship, real projects, and 100% placement support.

Enroll Now — Free Demo Available

Overflow X and Y – FAQs

Quick answers about learning Overflow X and Y in CSS.

This free note from CodingNow 2.0 explains Overflow X and Y in CSS — concept, syntax and worked code examples you can copy, run and revise before interviews.
Yes. Every CSS topic on CodingNow 2.0, including Overflow X and Y, is 100% free with no signup required.
With focused practice, most students grasp Overflow X and Y in 1–3 days from these notes; pairing it with CodingNow 2.0's mentor-led course takes you to job-ready depth faster.
Use the code examples in this note, then ask doubts for free on the CodingNow 2.0 Community (/community) — expert instructors answer within 24 hours.
WhatsApp
Call NowEnroll Now