3

On my Wordpress blog, I have right aligned the images when inserting them, where the body text wraps around them perfectly. I would however like to include text underneath the images such as "Click Here to Order".

I tried adding the order link html as a caption to the image media but that didn't seem to work. I also tried wrapping the image in a DIV and putting the link below it but it didn't group them as desired.

What would be the best way to accomplish this?

<h2>Best Mixers</h2>
[table id=2 /]
<h2><a name="kitchenaid"></a>Kitchenaid</h2>
<img class="alignright size-medium wp-image-1323" src="https://website.com/mixer-300x300.jpg" alt="Kitchenaid Mixer" width="300" height="300" />

enter image description here

2 Answers2

1

I Hope Help You:

img {
    width: 300px;
}

#divPic {
    float: right;
    margin-left:10px;
}

#divPic h3 {
    text-align: center;
    background: #000;
    color:orange;
    margin:0;
    padding: 0;
}
<div id="wrapper">
    <div id="divPic">
        <img src="http://www.mrwallpaper.com/wallpapers/cute-bunny-1600x900.jpg">
        <h3>Click Here to Order</h3>
    </div>
    <div>
        Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum. Aenean imperdiet. Etiam ultricies nisi vel augue. Curabitur ullamcorper ultricies nisi. Nam eget dui. Etiam rhoncus. Maecenas tempus, tellus eget condimentum rhoncus, sem quam semper libero, sit amet adipiscing sem neque sed ipsum. Nam quam nunc, blandit vel, luctus pulvinar, hendrerit id, lorem. Maecenas nec odio et ante tincidunt tempus. Donec vitae sapien ut libero venenatis faucibus. Nullam quis ante. Etiam sit amet orci eget eros faucibus tincidunt. Duis leo. Sed fringilla mauris sit amet nibh. Donec sodales sagittis magna. Sed consequat, leo eget bibendum sodales, augue velit cursus nunc,
        Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec
    </div>
</div>
Ehsan
  • 12,655
  • 3
  • 25
  • 44
0

Did you try

<div class="alignright">
    <img><br>
    text
</div>

(Note the <br>)

I'm not sure what Wordpress' various CSS rulesets (referred to by the class attribute) do, but your objective is to group the image and its caption together in a <div> and have that "object" (rather than just the <img>) float to the right.

FKEinternet
  • 1,050
  • 1
  • 11
  • 20
  • I did, it places the text above the other text as shown in the image I included. –  Jun 20 '17 at 04:03
  • I can't believe it was actually that simple! That did fix it though, I just added text-align: center and display: block to align the text in the middle. Thank you! –  Jun 20 '17 at 04:15