Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using overflow-y: hidden or overflow-x: hidden to only hide one side of an element

Tags:

People also ask

What is overflow-y and overflow-X?

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. You can use the overflow property when you want to have better control of the layout. The overflow property specifies what happens if content overflows an element's box.

What is the use of overflow-X hidden?

hidden: It is used to clip the content and no scrolling mechanism is provided. scroll: It is used to clip the content and providing a scrolling mechanism. auto: It provides a scrolling mechanism for overflowing boxes. initial: This property is used to set overflow-x property to its default value.

How do you hide overflow elements?

The trick is to use flex-flow: column wrap; in conjunction with overflow: hidden; on the container. The former dictates that the content is stacked vertically and that anything that does not fit should be wrapped into a second column, outside of the content box of the container.

How do I get rid of X axis overflow?

We can fix the X axis overflow by adding 'overflow-x: hidden' but by doing so overflow-y becomes assumed as 'auto'.


The title pretty much asks the question but I know using overflow-y: hidden and overflow-x: hidden you can hide either the top and bottom or the left and ride side of an element but is there a way to only hide one side using these selectors.

In particular I am interested in hiding the bottom of a div that is overflowing but not the top.

If not is there any other CSS only way to accomplish this desired effect?

There is a legitimate purpose for needing this and I'd like to see if there is a standard way of doing this.

To explain slightly, I am only in control of the CSS for a slideshow and I need to push an element inside the slideshow div up above the div however the overflow: hidden values are cutting off this pushed up div when I do this. I can remove the overflow: hidden completely of course but then that doesn't make for a very good slideshow!

A fiddle is included below:

https://jsfiddle.net/ejhyz7t3/