https://jsfiddle.net/2L9mznzu/
There are two empty text buttons, how to align them to a string?
.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>
Use the property vertical-align: topfor yours .button.
vertical-align: top
.button
A vertical-aligned CSS property indicates the vertical alignment of an inline or table-cell. Source: MDN
See the demo below:
.button { display: inline-block; vertical-align: top; width: 80px; height: 30px; line-height: 30px; background: gray; margin: 0 4px; text-align: center; }
just add vertical-align: middle;
.button { display: inline-block; width: 80px; height: 30px; line-height: 30px; background: gray; margin: 0 4px; text-align: center; vertical-align: middle;
}
div display:flex; , div.
display:flex;
.button { display: inline-block; width: 80px; height: 30px; line-height: 30px; background: gray; margin: 0 4px; text-align: center; } .container{ display:flex; flex-direction:row; align-items:center; }
<div class="container"><div class="button"> </div> <div class="button">Button </div> <div class="button"> </div> </div>
Source: https://habr.com/ru/post/1665196/More articles:C-Learning a specific memory address at runtime - cHow to Define a Security Profile in a Search - iosHow to check if a string is entered by a user in the format mm / dd / yyyy in android? - javaWhat is this syntax in Babel compiled code? - javascriptsplit, display data in two columns in pandas data frame - pythonAnother SDK or REST API for actions on Google? - actions-on-googleAnsible - Install a package attached to major versions - packagesGit split inital commit into 2 - gitCarousel is not autoplay and not accessible (Bootstrap 3) - javascriptfirst div element inside div - htmlAll Articles