Community Forums › Forums › Archived Forums › General Discussion › Image will not align right
Tagged: align left, align right, generate, image alignment
- This topic has 9 replies, 3 voices, and was last updated 11 years, 10 months ago by greenecon.
-
AuthorPosts
-
February 8, 2013 at 10:13 am #18944greeneconMember
http://www.thegreeneconomy.com: Generate
The image looks just fine in WordPress, but when I view on the web, it is always flush left, not right or center. I have tried all KINDS of things, but still, flush left. I saw a similar post, without an answer, but now I can’t find that post so am adding mine. I looked at wordpress.org, and they suggested I add the following to my CSS:
img.aligncenter {
display: block;
margin-left: auto;
margin-right: auto;
}img.alignright {
margin: 0 0 5px 10px;
display: inline;
}img.alignleft {
margin: 0 10px 5px 0;
display: inline;
}.alignright {
float: right;
}.alignleft {
float: left;
}I did, no luck. any ideas? It’s a real problem for a visual site like ours. It sstarted when we updated to WP 3.5x. It has NOT been a good experience.
February 8, 2013 at 11:17 am #18955February 8, 2013 at 12:33 pm #18972Tony @ AlphaBlossomMemberHello,
The css for your img (.post-image) has a large negative margin, -40px, which means it's moving the image very far to the left. That's causing the left edge to line up with the left edge of your container.
Try changing:
.post-image {
0 0 30px -40px !important;
}
to
.post-image {
0 0 30px -20px !important;
}
Tony Eppright | http://www.AlphaBlossom.com | Follow me on twitter @_alphablossom
February 8, 2013 at 2:31 pm #19046greeneconMember1: here is a URL:
http://www.thegreeneconomy.com/uncle-sam-wants-your-clean-tech/
The image at the top of the page should align right, but it is not. There is an image further down with a caption that is aligning right. This is the first time that has happened, so I suspect that caption may override the problem.
2: I changed css t:
.post-image {
0 0 30px -20px !important;
}Made no difference. Sometimes it seems that changes to CSS doesn't change anything. It could be Generate.
February 8, 2013 at 2:49 pm #19054Tony @ AlphaBlossomMemberI'm sorry, the code I entered is wrong (tried to edit it but couldn't), I left out the margin in front. Should be:
.post-image {
margin: 0 0 30px -20px !important;
}
If you can find the existing code in your generate style.css (around line 1386?), you can change it from -40 to -20. But I may have misunderstood which images you're talking about. This change is for the images here:
http://www.thegreeneconomy.com/category/funding-sections/
The thumbnails are all the way to the left, and I thought you were asking about those.
To change the large uncle sam pic on your /uncle-sam-wants-your-clean-tech/ page to be right aligned, you have to change (should be around line 2841):
.entry-content img {
float: left;
padding-right: 20px;
}
If you remove "float: left;" it will allow your images to work properly (either left align or right align).
Tony Eppright | http://www.AlphaBlossom.com | Follow me on twitter @_alphablossom
February 8, 2013 at 4:53 pm #19107greeneconMemberYou did it exactly right. It just started looking right. Thanks. I very much appreciate it.
February 21, 2013 at 7:11 am #21935greeneconMemberWorked to make images within posts align either right or left, but then the home page and category pages were messed up. The text no longer wrapped around the left side image. Not sure what to do now.
/* atk 2-2013 Recommend we remove 'float left' but that messed with home page */
.entry-content img {
float: left;
padding-right: 20px;
max-width: 100%;
}/* Recommend we remove 'float left' but that messed with category pages ATK 2-20-13 */
.post-image {
float: left;
background-color: #fff;
border: 1px solid #ddd;
padding: 4px;February 21, 2013 at 1:34 pm #22035Tony @ AlphaBlossomMemberI guess I don't understand what you're trying to do.
Right now, there is no float:left on .post-image. If you have .post-image floated left, the category pages look fine, as well as the other pages.
Tony Eppright | http://www.AlphaBlossom.com | Follow me on twitter @_alphablossom
February 21, 2013 at 2:46 pm #22051greeneconMemberI am trying to have the images within a post have the ability to align right. I asked the question, and made changes above which did indeed allow us to flush images within posts to align right.
HOWEVER, we then had the category and home page images (the top section, not the two columns below) no longer wrap text. So we have added the
flush: left;
back in where we took it out, and that works fine, but now the images within posts no longer will align right. We're back where we started. Tana
February 21, 2013 at 3:02 pm #22055greeneconMemberLooks like resolved. I had two of these posts going under 2 categories as it took so long for anyone to answer. The other guy said to add:
.home .entry-content img {
float: left;
padding-right: 20px;
}Which fixed the home page problem, then I could remove the float left from .entry-content and add it back to post.image. Everything is now working.
-
AuthorPosts
- The forum ‘General Discussion’ is closed to new topics and replies.