Home > front end >  Tailwind text align bottom
Tailwind text align bottom

Time:05-27

I have the following code that creates two <p> tags to store some text:

<p v-if="my_property <= 0" >{{Math.abs(my_value)}}%</p>
<p v-else >{{my_value}}%</p>
<div >
   <p >tsa</p>
</div>

I'm trying to have the last <p> tag align bottom as compared to the first. I've tried putting the <p> tag currently in the <div> inside and outside a <div> tag, but I can't seem to get the result right, and it currently looks like this:

enter image description here

I want the "tsa" text to appear here:

enter image description here

What do I need to change about the way I've currently got it?

Note: I've highlighted the <div> in yellow to just show the text is not aligned to the bottom of it.

CodePudding user response:

You can solve your issue by adding a flex-container for all your <p> tags.

  <div >
    <p v-if="my_property <= 0" >{{Math.abs(my_value)}}%</p>
    <p v-else >29%</p>
    <p >tsa</p>
  </div>

enter image description here

CodePudding user response:

You can follow the below code for the solution

<script src="https://cdn.tailwindcss.com"></script>


<div v-if="my_property <= 0" >{{Math.abs(my_value)}}% 
  <span >tsa</span>
</div>

<div v-else >{{my_value}}% 
  <span >tsa</span>
</div>

  • Related