Solved

Wordpress CSS question

Posted on 2012-03-27
1
650 Views
Last Modified: 2012-03-27
Hi Experts,

I did a custom theme for a WP site and when I add an image in wp page editor and choose right align it appears fine in the editor but when I preview the page it's left aligned.

Seems that it's following the <p> tag left align property and my custom CSS doesn't have the styles to do the image alignment needed by the editor.  (alignright size-medium wp-image-150)

where are these apparently default styles typically found?  Is there some default style sheet or style that are to be included in all themes?

i.e.:  <a href="http://website.ca/wp-content/uploads/2012/03/stock-photo-13325752-woman-smile.jpg"><img class="alignright size-medium wp-image-150" title="stock-photo-13325752-woman-smile" src="http://website.ca/wp-content/uploads/2012/03/stock-photo-13325752-woman-smile-300x206.jpg" alt="" width="300" height="206" /></a>

Thanks,

HNM
0
Comment
Question by:HelpNearMe
1 Comment
 
LVL 12

Accepted Solution

by:
Tony van Schaik earned 500 total points
ID: 37773860
This is the default CSS code that Wordpress uses, just add them to your stylessheet and change it to your needs:

img.alignright {float:right; margin:0 0 1em 1em}
img.alignleft {float:left; margin:0 1em 1em 0}
img.aligncenter {display: block; margin-left: auto; margin-right: auto}
.alignright {float:right; }
.alignleft {float:left; }
.aligncenter {display: block; margin-left: auto; margin-right: auto}

Open in new window


More info on that can be found here:

http://codex.wordpress.org/Wrapping_Text_Around_Images
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This is a how to build your own CSS3 slideshow and when I say CSS3 I mean just CSS with no javascript in sight! There a few examples online of how to do this but most just show you an example without any explanation, others make it more complicat…
This article discusses four methods for overlaying images in a container on a web page
The purpose of this video is to demonstrate how to integrate Mailchimp with WordPress, by placing a Mailchimp signup form on a WordPress Page or Post. This will be demonstrated using a Windows 8 PC. Mailchimp will be used. Log into your Mailchi…
The purpose of this video is to demonstrate how to prevent comment spam on a WordPress Website. This will be demonstrated using a Windows 8 PC. Plugin Akismet will be used. Go to your WordPress login page. This will look like the following: myw…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question