0

In various WordPress themes the margins are only applied to elements when they are images or captions

/* Images */
.alignleft {
    float: left;
}

.alignright {
    float: right;
}

.aligncenter {
    display: block;
    margin-left: auto;
    margin-right: auto;
}

img.alignleft {
    margin: 5px 20px 5px 0;
}

.wp-caption.alignleft {
    margin: 5px 10px 5px 0;
}

img.alignright {
    margin: 5px 0 5px 20px;
}

.wp-caption.alignright {
    margin: 5px 0 5px 10px;
}

img.aligncenter {
    margin: 5px auto;
}

img.alignnone {
    margin: 5px 0;
}

This is taken from the 2013 Theme. I coded a plugin and used this align classes to float the content. Now It looks ugly because the margins are only applied to images and wp-captions. So I have to add my own margins. My question is now why they to it this way. Why do they not give the bases classes some base margins? What elements do they want to float without margins?

I am asking for theme purposes, I use bootstrap which comes with .pull-left and .pull-right already that do nothing but float. So I not really need this classes for floating without margins. But maybe there is a good reason I should do it the way they do? I mean base margins could still be overwritten if needed so why?

1 Answer 1

0

You are right, you may have your own css rule not to follow 2013. I don't think the 2013 theme is representing official ccs rule since 2013 is not from the wordpress team, it's from Taiwan wp official. The reason 2013 is attached in the wp package is because it is a standard theme which follows the official basic rule which means just a demo theme nothing about style.

I was trying to say, it is just a demo css.

By the way the css you listed is from the official wordpress css core:http://codex.wordpress.org/CSS

And more, the other important thing of the css you post is.. It match the default post editor!(the class name will make the editor function works lol)

2
  • This is very confusing and contains dubious information. Twenty Thirteen is written by "the WordPress Team"... no idea what this stuff about Taiwan is about.
    – s_ha_dum
    Commented Sep 19, 2013 at 14:44
  • was just trying to express that the css style in 2013 theme is just a css demo. btw the previous 2013 version showed it by taiwan wp official(i mention this was also trying to say it is just a demo css style).
    – bard
    Commented Sep 19, 2013 at 15:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.