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

Thursday, November 17, 2022

[FIXED] How do I make fonts of different sizes vertically centered in html spans?

 November 17, 2022     css, html, vertical-alignment     No comments   

Issue

I'm making a pitch controller:

<div id="pitchWrapper">
  <span id="pitchButtons">-</span>
  <span id="pitchValue">0</span>
  <span id="pitchButtons">+</span>
</div>

I want the minus, plus, and pitch value all to be vertically centered. I want the plus and minus to be a bigger font-size than the pitch value.

It works reasonably well when I set the font sizes to all be the same...

enter image description here

...but when I try to make the pitch buttons bigger, they align below center:

enter image description here

Here's my css:

#pitchWrapper {
  display: flex;
  align-items: center;
  vertical-align: middle;
}

#pitchValue {
  font-size: 200%;
}

#pitchButtons {
  font-size: 300%;
}

How can I increase the font size of the pitch buttons while keeping everything vertically centered please?

Thank you.


Solution

for your CSS instead of vertical-align, try justify-content: center



Answered By - Jude Bobinihi
Answer Checked By - David Marino (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