I’m trying to change the position of text in WordPress plugin. All I want to do is move text to the bottom of main div. I’ve tried position: absolute;
position:fixed
and also clear:both
but nothing.
Here’s my html stucture:
<div class="wc-restaurant-menu-product" data-product-id="1" data-order-type="lightbox" data- quantity="1">
<div class="wc-restaurant-menu-product-inner">
<div class="image" style="background-image:url('https://previews.123rf.com/images/fordzolo/fordzolo1506/fordzolo150600296/41026708-example-white-stamp-text-on-red-backgroud.jpg');"></div>
<div class="details">
<div class="header">
<div class="name">Title</div>
<div class="price"><span class="woocommerce-Price-amount amount"><bdi>21.00 <span class="woocommerce-Price-currencySymbol">$</span></bdi></span></div>
<div class="buy-button">
<button type="button" class="add icon" aria-label="Add to order">+</button>
</div>
</div>
<div class="description">Some textSome textSome textSome textSome textSome text</div>
</div>
</div>
</div>
And jsfiddle with all styles.
https://jsfiddle.net/qc5jnmyp/
Full plugin css:
https://jsfiddle.net/foutaLj7/
3
Answers
You have to put "description" class div outside of "wc-restaurant-menu-product".
I tried to paste the code but stackoverflow is not very effective at this.
You need to put
<div class="description">Some textSome textSome textSome textSome textSome text</div>
After "wc-restaurant-menu-product" closing tag
Just put
border
on the outer container not on the theimage
.Instead of putting border on class
.wc-restaurant-menu-product-inner
put border on class.wc-restaurant-menu-product
like this :Also, if wanted text more near to image put
margin-top
value negative in.description
.With the current structure, just change some CSS properties and you can move the text to the bottom of the main div.
From your statement in the question, I got that you need to keep your description at the bottom of the div as you already said in the question, which means something like this:
Enter image description here
If this is the case then just use
margin-top: auto;
on your description div.Here is the working example for you.
If you need it at the very bottom, then just remove the
padding-bottom
form details div or if you want something else. Please let me know.