View Full Version : How to center pictures on page?
Daniel
03-23-2005, 07:29 PM
Hi, all
I *love* Pixelpost. It's been one of the easiest, most intuitive blogging tools I've ever used.
Yet I can't figure out how to center a picture in my template. I'm using a slightly modified version of the Greycard template, and images are centered as long as they're around 750 pixels wide.
If they're smaller, however, they left-align, as in this post:
http://www.eastcolfax.com/blog/index.php?showimage=20
Any ideas on where to start looking and/or what to change? Thanks!
Daniel
You could just put a <div align="center"></div> tag around your image/a href in your template. That would probably be a quick and dirty solution ;)
Anonymous
03-23-2005, 08:08 PM
You could just put a <div align="center"></div> tag around your image/a href in your template. That would probably be a quick and dirty solution ;)
Thanks, Commando. I've poked around my styles.css and image_template.html, but I don't see anything that stands out as the actual image itself.
There's a "src="images/<IMAGE_NAME>" bit in the image_template, and an interesting "#image_info" section in the styles.css, but I don't see a basic HREF anywhere for the image.
Any ideas?
Thanks!
Daniel
The HTML for your image is;
<!-- image -->
<a href="index.php?showimage=<IMAGE_PREVIOUS_ID>"><img id="image" src="images/<IMAGE_NAME>" alt="<IMAGE_TITLE>" title="Click for <IMAGE_PREVIOUS_TITLE>" /></a>
<!-- image info -->
So, you could add image in your CSS since the img tag has that id.
You add something like this;
#image {
text-align:center;
}
I am not a CSS guru though, but it might work. Don't forget to reload to refresh your css.
you could also try wrapping the image in a center tag like this;
<!-- image -->
<div align="center"><a href="index.php?showimage=<IMAGE_PREVIOUS_ID>"><img id="image" src="images/<IMAGE_NAME>" alt="<IMAGE_TITLE>" title="Click for <IMAGE_PREVIOUS_TITLE>" /></a></div>
<!-- image info -->
Anonymous
03-25-2005, 02:50 PM
Thanks, Commando. You've given me places to look, and that's exactly what I needed!
Daniel
The HTML for your image is;
<!-- image -->
<a href="index.php?showimage=<IMAGE_PREVIOUS_ID>"><img id="image" src="images/<IMAGE_NAME>" alt="<IMAGE_TITLE>" title="Click for <IMAGE_PREVIOUS_TITLE>" /></a>
<!-- image info -->
So, you could add image in your CSS since the img tag has that id.
You add something like this;
#image {
text-align:center;
}
I am not a CSS guru though, but it might work. Don't forget to reload to refresh your css.
you could also try wrapping the image in a center tag like this;
<!-- image -->
<div align="center"><a href="index.php?showimage=<IMAGE_PREVIOUS_ID>"><img id="image" src="images/<IMAGE_NAME>" alt="<IMAGE_TITLE>" title="Click for <IMAGE_PREVIOUS_TITLE>" /></a></div>
<!-- image info -->
vBulletin® v3.7.3, Copyright ©2000-2013, Jelsoft Enterprises Ltd.