w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
css position label text in the true center (vertical and horizontal) without moving the label

You can use line-height: 30px; to center a single line of text instead. The 30px needs to be the same value as the height of the element you wish to vertically center text in.

Note: The fiddle has height:40px whereas the code in question has height:30px. Just choose the line-height to match the height.

vertical-align would actually moving the entire <label> (and text) down but only applies to inline-level and table-cell elements. It is not applying in your case as the <label> is floated.





© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.