Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

overflow: hidden not working as I expect

Posted on 2012-04-13
3
Medium Priority
?
227 Views
Last Modified: 2012-05-02
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.
0
Comment
Question by:Curtis Long
3 Comments
 
LVL 38

Expert Comment

by:Tom Beck
ID: 37844537
Try this:

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

Author Comment

by:Curtis Long
ID: 37857386
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.
0
 
LVL 1

Accepted Solution

by:
nzwebbie earned 2000 total points
ID: 37859821
Hi, the second comment on the following page I like and might have the solution you were after...
http://stackoverflow.com/questions/57725/how-can-i-display-just-a-portion-of-an-image-in-html-css
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article was originally published on Monitis Blog, you can check it here . Today it’s fairly well known that high-performing websites and applications bring in more visitors, higher SEO, and ultimately more sales. By the same token, downtime…
Ready to get certified? Check out some courses that help you prepare for third-party exams.
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

926 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question