Solved

horizontal centering of image in <td> with css generated drop shadow

Posted on 2009-05-12
3
808 Views
Last Modified: 2012-08-13
looking to center an image that is using a css generated drop shadow with negative margins and float:left;

i'm using tables as opposed to pure css because of the cms we're plugging this into.

here's the link:

http://ctemps.cjehost.com/thumbs2_table.php

notice how the thumbnails are horizontally aligned to the left-i need them to horizontally align center.  i'm sure it's the float:left and negative margins that are throwing me for a loop here. but, short of rethinking my drop shadow styles can anyone think of a quick fix here??
/*GALLERY DROP SHADOW*/

.img-shadow {

float:left;

background: url(../images/drop_shadow.png) no-repeat bottom right !important;

background: url(../images/drop_shadow.png) no-repeat bottom right;

margin: 10px 0 0 10px !important;

margin: 10px 0 0 5px;

}

/*GALLERY IMAGE href*/

a.imgOver img:hover{

background-color: #b81652;

}

a.imgOver img{

display: block;

position: relative;

margin: -10px 1px 1px -10px;

padding: 4px;

}
 

html:
 

<td height="136" width="136" align="center">

						<div class="img-shadow"><a href="#" class="imgOver"><img src="images/fpo_thumb_num4.jpg" border="0" /></a></div></td>

Open in new window

0
Comment
Question by:phillystyle123
3 Comments
 
LVL 49

Accepted Solution

by:
Roonaan earned 500 total points
ID: 24391254
You can make your div have margin:0 auto with a specific width if you know the image width.

You can use display:inline with bottom-padding on your div/a if your image is flexible. Then use text-align:center on your td.
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Shoutout to Emily Plummer (http://www.experts-exchange.com/members/eplummer26.html) for giving me this article! She did most of it, I just finished it up and posted it for her :)    Introduction In a previous article (http://www.experts-exchang…
Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
In this tutorial viewers will learn how to embed custom externally-hosted Google Fonts using the Google Font API in CSS Go to the Google Fonts website at google.com/fonts: Browse or search based on font properties or name to find a suitable font for…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

747 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

10 Experts available now in Live!

Get 1:1 Help Now