DoyleChris98 Posted February 8, 2015 Share Posted February 8, 2015 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;} Link to comment Share on other sites More sharing options...
Ingolme Posted February 8, 2015 Share Posted February 8, 2015 Set the line-height to the same value as the height. Link to comment Share on other sites More sharing options...
WestX64 Posted February 13, 2015 Share Posted February 13, 2015 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now