How To Make A Div Scrollable
Make a div horizontally scrollable using CSS
In this commodity, we will know to design the horizontally scrollable div using CSS, & will run into its implementation through the example. We can make a div horizontally scrollable by using the CSS overflow holding. At that place are different values in the overflow holding. For eg, the overflow: auto; is used for adding a scrollbar automatically whenever it is required and the axis hiding process similar overflow-x: motorcar; is used to make only a horizontal scrollable bar.
For horizontal scrollable bar utilise the x and y-axis. Set the overflow-y: subconscious; and overflow-10: automobile; that will automatically hide the vertical ringlet bar and present only the horizontal scrollbar. The white-space: nowrap; property is used to wrap text in a single line. Here the scroll div volition be horizontally scrollable.
Example 1: In this example, nosotros have used the overflow-y: hidden; and overflow-x: auto; to make div horizontally scrollable.
HTML
<!DOCTYPE html>
<
html
>
<
caput
>
<
title
>
Making a div horizontally
scrollable using CSS
</
championship
>
<
style
>
h1 {
color: Green;
}
div.whorl {
margin: 4px, 4px;
padding: 4px;
groundwork-color: #08c708;
width: 300px;
overflow-x: auto;
overflow-y: subconscious;
white-space: nowrap;
}
</
style
>
</
head
>
<
body
>
<
center
>
<
h1
>GeeksforGeeks</
h1
>
<
h2
>
Making a div horizontally
scrollable using CSS
</
h2
>
<
div
class
=
"scroll"
>
It is a proficient platform to acquire programming.
Information technology is an educational website. Ready for the
Recruitment bulldoze of production based companies
like Microsoft, Amazon, Adobe etc with a free
online placement grooming grade. The grade
focuses on various MCQ's & Coding question probable
to be asked in the interviews & make your upcoming
placement season efficient and successful. Also,
any geeks can help other geeks past writing manufactures
on the GeeksforGeeks, publishing articles follow few
steps that are Manufactures that need niggling modification
or improvement from reviewers are published commencement.
To quickly become your articles reviewed, please refer
existing manufactures, their formatting style, coding fashion,
and try to make you are close to them. In case y'all are a
beginner, you may refer Guidelines to write an Article
</
div
>
</
middle
>
</
body
>
</
html
>
Output:
Example ii: In this example, we have used the auto in place of overflow-y: hidden; and overflow-ten: car; to make div horizontally scrollable.
HTML
<!DOCTYPE html>
<
html
>
<
head
>
<
title
>
Making a div horizontally
scrollable using CSS
</
title
>
<
style
>
h1 {
color: Green;
}
div.scroll {
margin: 4px, 4px;
padding: 4px;
background-color: #08c708;
width: 300px;
overflow: motorcar;
white-space: nowrap;
}
</
style
>
</
head
>
<
trunk
>
<
center
>
<
h1
>GeeksforGeeks</
h1
>
<
h2
>
Making a div horizontally
scrollable using CSS
</
h2
>
<
div
course
=
"scroll"
>
It is a good platform to larn programming.
It is an educational website. Prepare for
the Recruitment drive of production based companies
like Microsoft, Amazon, Adobe etc with a gratuitous
online placement grooming class. The
course focuses on diverse MCQ's & Coding question
probable to be asked in the interviews & make your
upcoming placement season efficient and successful.
Too, any geeks tin assist other geeks past writing
articles on the GeeksforGeeks, publishing articles
follow few steps that are Manufactures that need petty
modification or comeback from reviewers are
published first.
To chop-chop get your manufactures reviewed, delight refer
existing articles, their
formatting style, coding style, and try to brand you
are close to them. In case you are a beginner, you
may refer Guidelines to write an Commodity
</
div
>
</
middle
>
</
body
>
</
html
>
Output:
CSS is the foundation of webpages, is used for webpage development by styling websites and web apps. You can acquire CSS from the footing up by following this CSS Tutorial and CSS Examples.
Source: https://www.geeksforgeeks.org/make-a-div-horizontally-scrollable-using-css/
0 Response to "How To Make A Div Scrollable"
Post a Comment