NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page Centering an Image Using CSS

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search
5 members in live chat ~  


Closed Thread
 
LinkBack Thread Tools
Old 02-23-2006, 09:56 AM THREAD STARTER               #1 (permalink)
NamePros Regular
Join Date: May 2005
Location: Northern Ireland
Posts: 755
aaronfalloon has a spectacular aura aboutaaronfalloon has a spectacular aura about
 



Centering an Image Using CSS


How do you center an image using CSS? Thanks in advance.
Last edited by ComDriver; 02-23-2006 at 10:05 AM.
aaronfalloon is offline  
Old 02-23-2006, 10:13 AM   #2 (permalink)
NamePros Regular
Join Date: Jun 2003
Location: Louisiana, USA
Posts: 661
painperdu has a spectacular aura aboutpainperdu has a spectacular aura about
 



The image needs to be in a container and then use 'text-align'.
painperdu is offline  
Old 02-23-2006, 10:28 AM   #3 (permalink)
A Wealth of Knowledge
 
stscac's Avatar
Join Date: Aug 2004
Posts: 3,803
stscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud of
 



The whole thing would look like this:
Code:
text-align:center;
-Steve
stscac is offline  
Old 02-23-2006, 10:37 AM THREAD STARTER               #4 (permalink)
NamePros Regular
Join Date: May 2005
Location: Northern Ireland
Posts: 755
aaronfalloon has a spectacular aura aboutaaronfalloon has a spectacular aura about
 



I read somewhere were that wasn't the recomended way, is there any other methods?
aaronfalloon is offline  
Old 02-23-2006, 01:29 PM   #5 (permalink)
NamePros Regular
 
Jim_'s Avatar
Join Date: Aug 2005
Location: NY, USA
Posts: 608
Jim_ is a splendid one to beholdJim_ is a splendid one to beholdJim_ is a splendid one to beholdJim_ is a splendid one to beholdJim_ is a splendid one to beholdJim_ is a splendid one to behold
 


Save The Children
Code:
margin-left: auto;
margin-right auto;
You might need to set width, but that should work.
__________________
ask me about the internet
Jim_ is offline  
Old 02-23-2006, 01:35 PM   #6 (permalink)
A Wealth of Knowledge
 
stscac's Avatar
Join Date: Aug 2004
Posts: 3,803
stscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud of
 



What other method with CSS is there?

You can either use css in the header of your file, an external style sheet, or, within an image tag directly in its CSS "style" attribute. I use the first two regularly, but the third is not my favorite.

-Steve
stscac is offline  
Old 02-23-2006, 02:04 PM   #7 (permalink)
NamePros Regular
 
Tree's Avatar
Join Date: Feb 2006
Location: Atlanta, GA, USA
Posts: 335
Tree will become famous soon enoughTree will become famous soon enough
 



Here's a one I found using The Anointed One. I haven't tested it myself, so it may or may not work.

Code:
<div style="text-align: center;">
  <div style="text-align: left; margin: 1em auto; width: 50%;">
  </div>
</div>
Tree is offline  
Old 02-23-2006, 02:26 PM THREAD STARTER               #8 (permalink)
NamePros Regular
Join Date: May 2005
Location: Northern Ireland
Posts: 755
aaronfalloon has a spectacular aura aboutaaronfalloon has a spectacular aura about
 



Thanks for the help guys, only the first method seems to be working. Thanks again.
aaronfalloon is offline  
Old 02-26-2006, 02:24 AM   #9 (permalink)
Account Suspended
 
jmweb's Avatar
Join Date: Jan 2004
Location: Charlottetown
Posts: 1,033
jmweb is a glorious beacon of lightjmweb is a glorious beacon of lightjmweb is a glorious beacon of lightjmweb is a glorious beacon of lightjmweb is a glorious beacon of light
 



you could also use

Code:
<img src="file.jpg" align="center">
jmweb is offline  
Old 02-26-2006, 06:22 AM THREAD STARTER               #10 (permalink)
NamePros Regular
Join Date: May 2005
Location: Northern Ireland
Posts: 755
aaronfalloon has a spectacular aura aboutaaronfalloon has a spectacular aura about
 



I don't think thats using CSS but thanks anyway.
aaronfalloon is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Greatest Image Gallery Tutorial Ever Wybe Webmaster Tutorials 5 12-20-2005 10:51 AM
Split this image into 100% CSS and get 200 NP$ - Even 1 free .com domain name. mholt Web Development Wanted 5 09-15-2005 05:25 PM
What Keywords? spy69 Search Engines 5 06-28-2005 08:05 PM
CSS and Two Image Rollover Effects wasabisam Programming 2 03-03-2004 06:12 AM

 
All times are GMT -7. The time now is 02:10 PM.

Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger