Link to home
Start Free TrialLog in
Avatar of DS928
DS928Flag for United States of America

asked on

Image Not Centering

I have an image in a div.  I am trying to get it to center.  First do I need the div?  Second I know about the block / image but I have different images on the page that I don't want affected.

<div class="skull"><img src="../../../../Logos/NewsFlash.jpg" width="200" height="275" alt="News Flash" longdesc="../../../../Logos/NewsFlash.jpg" /></div>

Open in new window


.skull {
	display: block;
    margin: 0 auto;
}

Open in new window


www.audiodigz.com

It's the News Flash Skull.  Thank you.
Avatar of DS928
DS928
Flag of United States of America image

ASKER

This worked.
.skull {
	width:85%;
	margin-left:auto;
	margin-right:auto;
}
.skull, img {
	display: block;
    margin: 0 auto;
}

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Pawan Kumar
Pawan Kumar
Flag of India 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
Avatar of DS928

ASKER

It worked, but it also affected the other image under featured.
Avatar of DS928

ASKER

Nope.  The image completely disappeared.
Glad that it worked.

Did u use that css on the other images also ? If yes do not use that css for other images.
Avatar of DS928

ASKER

This does not work either

<div class="skull"><img src="../../../../Logos/NewsFlash.jpg" width="200" height="275" alt="News Flash" longdesc="../../../../Logos/NewsFlash.jpg" /class="newsflash"></div>

Open in new window


.skull {
	padding-top:25px;
	width:85%;
	margin-left:auto;
	margin-right:auto;
}
.skull, newsflash {
	display: block;
    margin: 0 auto;
}

Open in new window

Avatar of DS928

ASKER

Changed the class in the css to:

.newsflash {
	display: block;
    margin: 0 auto;
}

Open in new window


and it worked.  Thank you for your help.
Avatar of DS928

ASKER

Although not the answer it sent me on my way to finding a correct solution.  Thank you.
Use this --

.skull, newsflash 
{
	display: block;
    margin: 0 auto;
}

Open in new window

Ohh glad you got it. You beat me :) . Cheers