PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, November 16, 2022

[FIXED] How to align center text that next to a span?

 November 16, 2022     alignment, css, html, html-table, vertical-alignment     No comments   

Issue

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

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



Answered By - Todor Markov
Answer Checked By - Marilyn (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing