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 center text that next to a span?

I am trying to put "per month" vertical-align to the price "$29" just like the picture.You can help me fix my code or give me a new way that is better for me.

This is what I want.

enter image description here

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

This is what I had

enter image description here

here is my HTML code.

  <div class="deal">
          <span class="price">&dollar;29</span>
          <span class="period">per month</span>
        </div>

and my css.

.price {
  font-size: 50px;
}
.monthly {
  color: #d0d3d4;
  vertical-align: middle;
  display: inline-block;
}

>Solution :

CSS

.deal{
  display:flex;
  align-items:center;
}
.period{
  margin-left:0.5rem;
}

jsfiddle

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