Webmaster Forum


Go Back   Webmaster Forum > Web Development > Coding Forum

Coding Forum Problems with your code? Discuss coding issues, including JavaScript, PHP & MySQL, HTML & CSS, Flash & ActionScript, and more.


Reply
 
LinkBack Thread Tools Display Modes
Share |
  #1 (permalink)  
Old 02-05-2010, 08:40 AM
AmySueN's Avatar
v7n Mentor
 
Join Date: 10-29-07
Location: Wisconsin
Posts: 1,467
iTrader: 0 / 0%
Using CSS to center images

Can CSS be used to center images? I tried the w3.org way and it doesn't work on my blog. I had been using the center html tag, but really want to use CSS.
__________________
www.MyHappyCrazyLife.com- Life in all its happy, crazy, spontaneous glory!

Cloth diapers can be fun?? You betcha - come and see! www.Zany-Zebra.com
 
Reply With Quote
  #2 (permalink)  
Old 02-05-2010, 09:10 AM
ScriptMan's Avatar
Super Moderator
 
Join Date: 02-10-07
Location: Central Kentucky
Posts: 10,263
iTrader: 4 / 100%
I cheat and use <p align="center"> when I am not floating them left or right.

I haven't looked at the wc site but I imagine a class in your CSS, something along the lines of:
p.center
{
text align: center;
}

would work. I am going to work on that some day soon. I just aren't a purist enough to have worried about it up until now. Let me if that works for you.

Tutor or Hades may jump in with the real solution.
__________________
SEO does not mean Spam Everywhere Online
Scriptman's Playhouse || Ramblings from an old man
2013 resolution: Don't feed trolls
ScriptMan
 
Reply With Quote
  #3 (permalink)  
Old 02-05-2010, 09:57 AM
AmySueN's Avatar
v7n Mentor
 
Join Date: 10-29-07
Location: Wisconsin
Posts: 1,467
iTrader: 0 / 0%
Thanks, ScriptMan, I'll try that.
__________________
www.MyHappyCrazyLife.com- Life in all its happy, crazy, spontaneous glory!

Cloth diapers can be fun?? You betcha - come and see! www.Zany-Zebra.com
 
Reply With Quote
  #4 (permalink)  
Old 02-05-2010, 11:52 AM
HTMLBasicTutor's Avatar
Super Moderator
 
Join Date: 10-29-07
Location: British Columbia, Canada
Posts: 18,271
iTrader: 5 / 100%
Quote:
Originally Posted by ScriptMan View Post
I haven't looked at the wc site but I imagine a class in your CSS, something along the lines of:
p.center
{
text align: center;
}
I'd do it this way except without the p in front so you can use the center setting for other stuff too.

This one from W3C would more versatile than their first example:
Code:
IMG.displayed { display: block; margin-left: auto; margin-right: auto } ... <IMG class="displayed" src="..." alt="...">
__________________

HTML Basic Tutor - Learn how to code for better SEO
Basic Computer Information - Computer & internet basics for website owners

SEO troubleshooting and review services available. - Pm me.
 
Reply With Quote
  #5 (permalink)  
Old 02-16-2010, 10:08 AM
HTMLBasicTutor's Avatar
Super Moderator
 
Join Date: 10-29-07
Location: British Columbia, Canada
Posts: 18,271
iTrader: 5 / 100%
Quote:
Originally Posted by ncpfree View Post
What is the best to minimize load type and server load?
Minimize the number of requests sent to the server. i.e. Number of times the browser has to go fetch something from the server.

Plan your CSS so there are a minimal number of individual styles used. Think recycle.

Combining elements with the same style saves on CSS file size but can be a bit confusing for someone new to CSS.

Making the style in one line instead of neatly spaced out in lines will save on CSS file size but again can be confusing for a beginner in CSS.
HTML Code:
body { font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 80%; background-color: #636954; margin: 0px; color: #000000; }
vs
Code:
body {font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 80%; background-color: #636954; margin: 0px; color: #000000;}
__________________

HTML Basic Tutor - Learn how to code for better SEO
Basic Computer Information - Computer & internet basics for website owners

SEO troubleshooting and review services available. - Pm me.
 
Reply With Quote
Go Back   Webmaster Forum > Web Development > Coding Forum

Reply


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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
WTS: Funny Pictures And Images Collection - Over 5000 Images F15 Content 6 01-26-2010 02:46 PM
a site has images and has no images for SEs livePR.ezer.com SEO Forum 5 05-04-2009 02:47 AM
Can't center images in a List Phil in Abbeville Coding Forum 8 02-24-2009 08:50 AM
center swf over jpeg? steeldoorarmor Coding Forum 3 05-07-2008 06:56 PM
What type of images and royalty free images do developers and webmasters need? EZRoyaltyFree Web Design Lobby 0 02-26-2008 08:11 AM


V7N Network
Get exposure! V7N I Love Photography V7N SEO Blog V7N Directory


All times are GMT -7. The time now is 01:52 AM.
Powered by vBulletin
Copyright © 2000-2013 Jelsoft Enterprises Limited.
Copyright © 2003 - 2013 Escalate Media LP




Search Engine Optimization by vBSEO 3.6.0 RC 2 ©2011, Crawlability, Inc.