Link to home
Start Free TrialLog in
Avatar of Curtis Long
Curtis LongFlag for United States of America

asked on

overflow: hidden not working as I expect

I have a html page that displays a list of images generated by a server, but I don't want to display the bottom 2% of the image. My solution was to use overflow:hidden on the containing div for the image and then to give the image a 2% margin-top after setting it to display:inline-block. This worked great for a simple proof of concept page I built, but not so much for the actual page.

A link for the working page:
Working page

A link for the non working page:
non-working

My end goal is to get rid of the white line on the bottom of each image on the non-working page.
Avatar of Tom Beck
Tom Beck
Flag of United States of America image

Try this:

.PreviewCell img {
    display: block;
    height: 100%;
    margin-top: 2%;
    position: relative;
    top: 2px;
    width: 100%;
}
Avatar of Curtis Long

ASKER

That didn't work. I wound up using a negative bottom margin.

.PreviewCell img
{
	display:inline-block;
	width:100%;
	height:100%;
	margin-bottom:-4%;
}

Open in new window


And that worked where using a positive top margin didn't. I'm not sure why, in fact I find it rather confusing.
ASKER CERTIFIED SOLUTION
Avatar of nzwebbie
nzwebbie
Flag of New Zealand image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial