Is it possible to use combined overflow CSS/JS? - css

I'm looking for a solution for combining different x and y overflow.
Following code:
div {
overflow-x: visible;
overflow-y: hidden;
}
doesn't work. I want a simple method to hide horizontal scrollbar, keeping the vertical overflown content visible. I do not want to change the DIV's height in layout. Any tricks?

I want a simple method to hide horizontal scrollbar, keeping the vertical overflown content visible.
for horizontal -> overflow-x
for vertical -> overflow-y
You could just use
div{
overflow-x: hidden;
overflow-y: auto; // if you don't want scrollbar use visible
}

Use the below.
div {
overflow-x: hidden;
overflow-y: scroll;
}
WORKING DEMO
The HTML Code:
<div>This is a div.</div>
The CSS Code:
div {
overflow-x: hidden;
overflow-y: scroll;
display:inline-block;
}
Hope this helps.

Related

Remove horizondal scroll

Is there any way to remove the horizontal scroll ?
There is no content towards the right but the area remains blank and scrolling comes .
The styles for modal are :
.ticketModal {
width: 1000px;
min-width: 1000px !important;
overflow: hidden;
max-width: 1000px;
}
You should add in your css overflow-x: hidden; to your main div or class, this will help you to remove horizontal scroll
If you don't want the horizontal scroll in the entire app. Simply add
*{
overflow-x: hidden;
}
This will remove the horizontal scroll for all the DOM elements

Flexbox overflow scroll in angular component

I am trying to build a two column design with an Angular 2 app. I created a plunker to reproduce my problem: https://plnkr.co/3Evxm9?p=info
I want the scrollable area to be the red div (.overflow), not the .page. Without the .page { overflow: auto } the page won't scroll at all, though I would expect .overflow to do so since it has a defined height of 100%. The padding is there to offset from the .top div. I initially though using margin instead, but without the overflow: auto on .page, the margin goes outsides the bounds of .container (which shrinks to fit the height (padding included, margin excluded) of .overflow.
I seem to misunderstand the behaviour of the flexbox.
I made some adjustment to your css to make the red area scrollable only.
css:
.page {
width: 100%; height: 100vh;
background: red;
flex: 1;
overflow: hidden;
}
.overflow {
font-size: 30px;
padding-top: 64px;
height: 93vh;
overflow: scroll;
}
Thanks for providing a plunker. It helped a lot to find a solution for you. Here's the link to the edited plunker.
Hope this helps!

Add scroll bar in div inside a table

index.html
<td>
<div id="wrapper">
words go her alot of them
</div>
</td>
style.css
#wrapper {
height: 100%;
width: 200px;
overflow: auto;
}
I am currently unable to get the scroll bar to appear, this is what I get:
You could use the overflow property:
#wrapper {
height: 100%;
width: 200px;
overflow: scroll;
}
The overflow property specifies what happens if content overflows an element's box.
This property specifies whether to clip content or to add scrollbars when an element's content is too big to fit in a specified area.
Note: The overflow property only works for block elements with a specified height.
Further reading - W3Schools
Further reading - MDN
Try setting
overflow: scroll;
Should do the trick
Try setting overflow to scroll:
#wrapper {
overflow: scroll;
}
You would need to add a height to the td tag;
Example:
height="250px" or change your height in your #wrapper.
overflow-y: scroll
i used this and it fixed the problem

How to make a responsive scrollable div inside another div using pure CSS

My webpage looks like this
My aim is to make the Outer Pad's height to fit the viewport height and make the inner Checklist scrollable. I have tried
.html{
height: 100%;
}
.pad{
height: 100%;
overflow: hidden;
}
.list{
height: 100%;
overflow-y: auto;
}
Fiddle: https://jsfiddle.net/chandannadig/esmrLzuv/10/
The moment scrollbars are visible, the data is pushed towards left and the pseudo elements I have used to get the folded effect are screwed up. I want to achieve the following:
Make '.list' scrollable without showing scrollbars
The pseudo elements should not be affected by the scrollbars
The design should be responsive
Please help me achieve this
I have updated your fiddle(The html is not looking similar to the screenshot given above however i tried my best to provide you a solution).
I have added
.content {
overflow: scroll;
width: calc(100% + 20px);
height:100%;
}
It solve the purpose list is scrollable calc(100% + 20px) adds extra space for scrollbar and it is responsive as well.

How to prevent vh-units from ignoring the scrollbar?

I am working on a page layout with a horizontal scrollbar.
I have some panels with fixed widths in a horizontal order, which should all have the viewport height. I decided to test the vh unit to do that.
.panel { height: 100vh; }
This is working fine, until I get a scrollbar.
The problem is, that vh ignores the height used by the scrollbar and therefore adds a vertical scrollbar.
I would like to subtract the height of the scrollbar from the measurements of vh; is there any way to do this?
You could use a parent element with overflow-y: hidden to ensure that you don't get a vertical scrollbar and then safely use 100vh inside it. This is assuming that you do actually need 100vh for some reason and don't just need to fill the vertical space.
HTML
<div id="main">
<div id="container"></div>
</div>
CSS
#main {
width:200vw;
height:100%;
background: red;
position: absolute;
overflow-y: hidden;
}
#container {
height: 100vh;
width:10px;
background: blue;
}

Resources