Solved

overflow: hidden not working as I expect

Posted on 2012-04-13
3
201 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:HDM
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:HDM
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 500 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
"In order to have an organized way for empathy mapping, we rely on a psychological model and trying to model it in a simple way, so we will split the board to three section for each persona and a scenario and try to see what those personas would Do,…
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

757 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now