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?