Home > Enterprise >  logo after last word multi-line - Tailwind
logo after last word multi-line - Tailwind

Time:09-17

I have a title with a fixed width, and I need to set a logo after the last word in the title.

When the title is too long, it takes 2 lines.

Example :

My
Title (logo should go here)

Here is a codepen with tailwind : https://codepen.io/jbrazillier/pen/OJZWYEb

I can only set it below the title, or on the right of the first word.

CodePudding user response:

Since you have fixed size for your h2 you should wrap your image and title in a relative div and your logo should be absolute then use position left-full

by the way you should improve your markup i added the border to show you what i mean

<script src="https://cdn.tailwindcss.com"></script>
<h2 >
  <div >My title
    <img  src="https://upload.wikimedia.org/wikipedia/commons/thumb/9/9f/Red-circle.svg/1200px-Red-circle.svg.png" alt="" />
  </div>
</h2>

  • Related