Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to align colored text on the same line

So as you can see in the picture below, I want to put the colored text on the same line as the other test (beside Balance).

enter image description here

I tried many things but nothing worked, here is my html file

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

.card-header p {
  color: #668eee;
}

.card {
  max-width: 600px;
  margin: auto;
}

.GreenTextColor {
  color: #33FF3C;
}

.RedTextColor {
  color: red;
}
<div class="container">
  <div class="card">
    <div class="card-header">
      <br> Account: <a href="{% url 'metrix' things.id %}">{{ things.accountid }}</a>
    </div>
    <div class="card-body">
      Balance: &nbsp;&nbsp;&nbsp;&nbsp;End: {{things.enddate}}&nbsp;&nbsp;&nbsp;&nbsp;Result: Not passed {% if things.balance >= 50000 %}
      <div class="GreenTextColor">
        {{things.balance}}
      </div>
      {% else %}
      <div class="RedTextColor">
        {{things.balance}}
      </div>
    </div>
  </div>

>Solution :

Add display: flex; to .card-body.

.card-header p {
  color: #668eee;
}

.card {
  max-width: 600px;
  margin: auto;
}

.GreenTextColor {
  color: #33FF3C;
}

.RedTextColor {
  color: red;
}

.card-body {
  display: flex;
}
<div class="container">
  <div class="card">
    <div class="card-header">
      <br> Account: <a href="{% url 'metrix' things.id %}">{{ things.accountid }}</a>
    </div>
    <div class="card-body">
      Balance: &nbsp;
      <div class="GreenTextColor">
        {{things.balance}}
      </div>
      <div class="RedTextColor">
        {{things.balance}}
      </div>
    </div>
  </div>
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading