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

Thursday, November 17, 2022

[FIXED] How to align these buttons in a row?

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

Issue

https://jsfiddle.net/2L9mznzu/

There are two empty text button, how to align them into a row?

.button {
  display: inline-block;
  width: 80px;
  height: 30px;
  line-height: 30px;
  background: gray;
  margin: 0 4px;
  text-align: center;
}
<div class="button">
</div>
<div class="button">Button
</div>
<div class="button">
</div>


Solution

Use vertical-align: top property to your .button.

The vertical-align CSS property specifies the vertical alignment of an inline or table-cell box. Source: MDN

See demo below:

.button {
  display: inline-block;
  vertical-align: top;
  width: 80px;
  height: 30px;
  line-height: 30px;
  background: gray;
  margin: 0 4px;
  text-align: center;
}
<div class="button">
</div>
<div class="button">Button
</div>
<div class="button">
</div>



Answered By - kukkuz
Answer Checked By - Cary Denson (PHPFixing Admin)
  • 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