Jump to content

Vertical Align


DoyleChris98

Recommended Posts

I am making a keypad that has 0-9, a period, and C. I am trying to figure out how to get the text to vertical align. Here is the code.

<div class="NUM" id="B1">1</div><div class="NUM" id="B2">2</div><div class="DISP1" id="COM1A" name="COM1A" onClick="CONVERT(this)">C1S</div>
#B1 {	width: 50px;	height: 50px;	top: 50px;	position: absolute;	left: 0px;	vertical-align: middle;}#B2 {	top: 150px;	position: absolute;	width: 50px;	height: 50px;	vertical-align: middle;}#COM1A {	width: 80px;	height: 25px;}.NUM{	background-color: #000000;	color: #00F349;	text-align: center;	border: thin solid #00F349;}

post-179939-0-82336000-1423433581_thumb.jpg

Link to comment
Share on other sites

Foxy Mod is correct, you would need to set the line-height to the same value as the height. Here is an example using your code:

#B1 {	width: 50px;	height: 50px;	top: 50px;	position: absolute;	left: 0px;	vertical-align: middle;        line-height: 50px;}#B2 {	top: 150px;	position: absolute;	width: 50px;	height: 50px;	vertical-align: middle;        line-height: 50px;}
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...