Solved

Wordpress CSS question

Posted on 2012-03-27
1
628 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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

CSS3 Custom checkboxes This article shows how to style the checkbox form element using only CSS. Works in: Chrome, FF, Safari, Opera, IE9+ Uses modernizr.js to check for :checked pseudo class, falling back to plain old checkboxes (IE8 and bel…
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
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…

708 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now