CSS
Overflow - scroll, auto, visible, hidden, overflow-x, overflow-y
- overflow: visible;:
- overflow: hidden;:
- overflow: scroll;:
- overflow: auto;:
- overflow-x and overflow-y:
The overflow
property in CSS is used to control what happens if content overflows its containing element. There are various values you can use with the overflow property to define different behaviors. Here are some common values:
¶overflow: visible;:
- This is the default value. Content will overflow the container and be rendered outside of it.
Copy code
<div style="width: 200px; height: 200px; border: 1px solid black; overflow: visible;">
This is some content that will overflow the container.
</div>
¶overflow: hidden;:
- Content that overflows will be hidden. This is useful when you want to clip the overflow.
<div style="width: 200px; height: 200px; border: 1px solid black; overflow: hidden;">
This is some content that will be hidden if it overflows the container.
</div>
¶overflow: scroll;:
- A scrollbar will be added to the container, allowing the user to scroll and see the hidden content.
<div style="width: 200px; height: 200px; border: 1px solid black; overflow: scroll;">
This is some content that will be scrollable if it overflows the container.
</div>
¶overflow: auto;:
- This value automatically adds a scrollbar only if the content overflows.
<div style="width: 200px; height: 200px; border: 1px solid black; overflow: auto;">
This is some content that will have a scrollbar if it overflows the container.
</div>
¶overflow-x and overflow-y:
- These properties allow you to control the overflow behavior for the horizontal and vertical axes separately.
<div style="width: 200px; height: 100px; border: 1px solid black; overflow-x: hidden; overflow-y: scroll;">
This is some content that will have a vertical scrollbar but no horizontal scrollbar.
</div>
These are basic examples to give you an idea of how the overflow
property works in different scenarios. You can customize the sizes, borders, and content to suit your specific needs.
CSS Selector-Child, Sibling, Attribute, :first-child, nth-child(2n)
Unlocking Responsive Design: CSS Strategies and Media Techniques
All Tutorials in this playlist
Popular Tutorials
Categories
-
Artificial Intelligence (AI)
11
-
Bash Scripting
1
-
Bootstrap CSS
0
-
C Programming
14
-
C#
0
-
ChatGPT
1
-
Code Editor
2
-
Computer Engineering
3
-
CSS
28
-
Data Structure and Algorithm
18
-
Design Pattern in PHP
2
-
Design Patterns - Clean Code
1
-
E-Book
1
-
Git Commands
1
-
HTML
19
-
Interview Prepration
2
-
Java Programming
0
-
JavaScript
12
-
Laravel PHP Framework
37
-
Mysql
1
-
Node JS
1
-
Online Business
0
-
PHP
28
-
Programming
8
-
Python
12
-
React Js
19
-
React Native
1
-
Redux
2
-
Rust Programming
15
-
SEO - Search Engine Optimization
1
-
Tailwind CSS
1
-
Typescript
10
-
Uncategorized
0
-
Vue JS
1
-
Windows Operating system
1
-
Woocommerce
1
-
WordPress Development
2
Tags
- Artificial Intelligence (AI)
- Bash Scripting
- Business
- C
- C Programming
- C-sharp programming
- C++
- Code Editor
- Computer Engineering
- CSS
- Data Structure and Algorithm
- Database
- Design pattern
- Express JS
- git
- Git Commands
- github
- HTML
- Java
- JavaScript
- Laravel
- Mathematics
- MongoDB
- Mysql
- Node JS
- PHP
- Programming
- Python
- React Js
- Redux
- Rust Programming Language
- SEO
- TypeScript
- Vue JS
- Windows terminal
- Woocommerce
- WordPress
- WordPress Plugin Development