View Full Version : How to make a class that always includes the same nested elements by default?

11-12-2012, 07:38 PM
So I have an idea, I want to have a class I can call using a shortcode in a theme I am making for wordpress and I want it to always have an image that the text wraps around. A good example would be if I made a class that would be called saying "Did you know?" every time and around that part it allowed you to display text about your little quick fact snippet.

Basically I want to make a class that has a default image floated to the left so I can always just wrap the text-box content around it, if that makes sense. I have seen this done somehow I just don't know how to do it.

Thanks for the help in advance!

Attached is a mock up of what I mean.

11-13-2012, 06:35 AM

div.myclass img{
margin:0 5px 5px 0;

<div class="myclass">
<img src="" .....>
<p>Paragraph 1</p>
<p>Paragraph 2...</p>