WebProWorld Part of WebProNews.com
Page One Link To Us Edit Profile Private Messages Archives FAQ RSS Feeds  
 

Go Back   WebProWorld > Site Design > Graphics & Design Discussion Forum
Subscribe to the Newsletter FREE!


Register FAQ Members List Calendar Arcade Chatbox Mark Forums Read

Graphics & Design Discussion Forum Post your graphics design questions/comments/ideas in here. Ask questions, post tutorials, discuss trends and best practices. Sub-forum for website accessibility and usability.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-23-2003, 02:21 PM
WebProWorld Member
 

Join Date: Nov 2003
Posts: 93
TheDoctor RepRank 0
Default How do you center an image using HTML?

How do you center an image using HTML?

Vertically and horizontally?

Thanks
Reply With Quote
  #2 (permalink)  
Old 12-23-2003, 05:39 PM
Duncan Pollock's Avatar
WebProWorld Veteran
 

Join Date: Jul 2003
Location: Niagara-on-the-Lake, Ontario, Canada
Posts: 893
Duncan Pollock RepRank 1
Default How do you center an image?

It will depend on which page creation program you're using, but somehow, someway you should see a tab for position/relation-to-text/justification/whatever that allows you to choose FlushLeft/FlushRight/Center. Making your choice should then insert the necessary html.
I'm assuming here, of course, that you're using some WYSIWYG editor. Otherwise, however, you should be able to see the appropriate html by going to the Source Code of any site that includes an image in the sort of location you want to achieve yourself.

Duncan
__________________
Acts as an Exclusive Buyer Broker for purchasers of residential, industrial, commercial, and investment properties in all parts of the Niagara Peninsula.
http://www.duncanpollock.com
http://www.iciniagara.com
Reply With Quote
  #3 (permalink)  
Old 12-23-2003, 05:50 PM
WebProWorld New Member
 

Join Date: Dec 2003
Posts: 1
flashgc RepRank 0
Default Center an image in what?

There are a number of ways to do it depending on where the image is to be located in relation to the rest of the stuff on the page.

Putting it in a table? In the <td> tag of a table you could put:
Code:
<td align="center" valign="middle">
[img]whatever/path/pic.gif[/img]
</td>
Duncan's comments about a WYSIWYG editor are right on also. A lot depends on what you're using to edit your files. Note that the positioning is an attribute of the space in which you place the image, not the image itself.
__________________
Where are we going and why am I in this handbasket?
Reply With Quote
  #4 (permalink)  
Old 12-23-2003, 06:19 PM
ronniethedodger's Avatar
WebProWorld 1,000+ Club
 

Join Date: Aug 2003
Location: Central US
Posts: 1,581
ronniethedodger RepRank 0
Default Re: Center an image in what?

Quote:
Originally Posted by flashgc
Putting it in a table? In the <td> tag of a table you could put:
Code:
<td align="center" valign="middle">
[img]whatever/path/pic.gif[/img]
</td>
You would also have to center the table as well.

Code:
<div align="center">
<table>
  <tr>
    <td align="center" valign="middle">
     [img]whatever/path/pic.gif[/img]
    </td>
  </tr>
</table>
</div>
But this would only center the table horizontally, and not vertically.

Vertical alignment would require knowing the Height of the browser window...which you cannot determine from Html. A little javascript (or other coding) would be in order.[/code]
Reply With Quote
  #5 (permalink)  
Old 12-23-2003, 06:49 PM
WebProWorld Member
 

Join Date: Nov 2003
Posts: 93
TheDoctor RepRank 0
Default

Thanks

Do you know what the Java Script is?
Reply With Quote
  #6 (permalink)  
Old 12-23-2003, 07:46 PM
ronniethedodger's Avatar
WebProWorld 1,000+ Club
 

Join Date: Aug 2003
Location: Central US
Posts: 1,581
ronniethedodger RepRank 0
Default

Quote:
Originally Posted by TheDoctor
Thanks

Do you know what the Java Script is?
That is a complicated question. It is dependant on the type of browser for one. Also if this a new window you would be popping up...or in the existing browser window.

There are a couple of places on the net with a lot of javascript snippets and examples that you can use. They usually have demos and descriptions of the code to go with them. One just needs to find one that suits them and plug in the code.

Here is a few places to start:

http://javascript.internet.com/
http://html.tucows.com/programmer/js...i_windows.html
http://devedge.netscape.com/central/javascript/

A directory of some javascript sites:

http://dir.evolt.org/coding/client-side/javascript/

And the ever popular Google search !!!
Reply With Quote
Reply

  WebProWorld > Site Design > Graphics & Design Discussion Forum
Tags: , , ,



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

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


Search Engine Optimization by vBSEO 3.2.0