Wordpress Themes - WP Forum at BFA
Click here to register or to donate.
Auto self-registration is not available here - far too many spammers. This forum has many, many backlinks and because of that there is an intense desire among spammers to drop their links here.

Wordpress Themes - WP Forum at BFA » WordPress Themes » Atahualpa 3 Wordpress theme » Center area post/pages »

[SOLVED] Centring images with CSS?


  #1  
Old Mar 18, 2012, 12:20 PM
Dapizz's Avatar
Dapizz
 
15 posts · Mar 2012
Great British Isles
The title sort of says it all, but this is really confusing me. I go into the the Style Images section and add:

Code:
margin-left: auto;
margin-right: auto;
As far as my web searching goes, this should essentially centre all the images affected, all the images in my posts/pages. Instead it only applies to images in sticky posts. Look here. If you look at the sign image in the sticky post you can see it's centred, but if you scroll down the page to the other image (Ctrl + F, paste in "February 3rd, 2012") it is not quite so. This is really beginning to bug me... Any help appreciated.

-Dapizz
  #2  
Old Mar 18, 2012, 01:02 PM
juggledad's Avatar
juggledad
 
23,667 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
how were the two images added to the posts?
what HTML is involved in the two images? What surrounds them?
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #3  
Old Mar 18, 2012, 02:57 PM
lmilesw's Avatar
lmilesw
 
10,174 posts · Jul 2009
Central New York State USA
For margin auto to work in centering the element being centered needs a width supplied. I am not sure how you would go about centering all images. That is generally done when you add an image you just select center as the alignment.
__________________
~Larry (CNY Web Designs)
This site should be a membership site since it so full of good stuff.
Please consider donating which gives you access to even more good stuff.
  #4  
Old Mar 19, 2012, 12:38 PM
Dapizz's Avatar
Dapizz
 
15 posts · Mar 2012
Great British Isles
Quote:
Originally Posted by juggledad
how were the two images added to the posts?
what HTML is involved in the two images? What surrounds them?
Juggledad,
1) Using the image adder at the top of the post 'kitchen'. HTML wise, just an IMG tag and an SRC.
2) The same. Like mentioned above.
3) if you mean HTML, there's no centre tag around either. I checked but did notice that written inside the IMG tag there was:
Code:
class="size-full wp-image-13 aligncenter"
I know I never added this manually, so I'm not sure how it got there. It isn't on the other image, so I guess that's what's happening. if this is so, couldn't I go to ATO>Add CSS/HTML Inserts and add something along the lines of:
Code:
img { size: full; align: center; }
Thanks for the reply.
  #5  
Old Mar 19, 2012, 12:41 PM
Dapizz's Avatar
Dapizz
 
15 posts · Mar 2012
Great British Isles
Quote:
Originally Posted by lmilesw
For margin auto to work in centering the element being centered needs a width supplied. I am not sure how you would go about centering all images. That is generally done when you add an image you just select center as the alignment.
LMilesW,
Both images do have width and height specified in the HTML. I did, however, notice that only the second image was linked in an A tag if this would make any difference.
Thanks,
  #6  
Old Mar 19, 2012, 02:36 PM
juggledad's Avatar
juggledad
 
23,667 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
The images weren't added teh same way because one is just an <img> (with the class 'aligncenter' in a <p> while the other is an <img> (with NO class assigned) in a <a> in a <p>

add 'class="aligncenter"' to the second image
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #7  
Old Mar 19, 2012, 03:01 PM
Dapizz's Avatar
Dapizz
 
15 posts · Mar 2012
Great British Isles
OK, thanks. Just wondering if there was an easy way. Lucky I only have a few images on my blog. I'll have to remember for the the future. Thanks for all the help though.

Bookmarks

Tags
centre, centred, css, images, sticky.

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
will header images do Javascript rotation and crossfade with a random order of images adamslc8 Header configuration & styling 3 Oct 14, 2011 12:58 PM
Auto-resizing for images/max width for images? SilverLining Center area post/pages 1 May 5, 2011 08:49 AM
Header Images - One fixed image for Home Page - Rotate all images on all other pages? ClearlyRobert Header configuration & styling 10 Oct 12, 2010 12:12 PM
Rotating Images on Homepage with Static Images on Other Pages chainpin Header configuration & styling 0 Sep 7, 2010 07:32 PM
How do I add margins/spacing to ALL images using the Images section? oskarfalk Atahualpa 3 Wordpress theme 1 Sep 2, 2009 06:09 AM


All times are GMT -6. The time now is 05:05 PM.


Powered by vBulletin® Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.