Search term
Search
Home
RSS
About
Careers 2.0
CodePen
GitHub
Google+
Google Play
LinkedIn
Stack Exchange
Twitter
Projects
Korean Vocab Widget
Pathfinding Visualizer
sortable-table.js
sticky-header.js
CS
Algorithms
AI
Data structures
Graphs
Trees
Searching
Sorting
SEng
Design patterns
.NET
ASP.NET MVC
C#
Extension methods
Razor
Umbraco
Visual studio
Java
Android
Web
CSS
Dart
HTML
JavaScript
jQuery
SASS
Growing with the Web
Thursday, 21 June 2012
Centering text vertically using CSS
Tags:
CSS
HTML
This is the easiest and best way to center text vertically, simply set the line-height to the same value as height. Remember that in order to modify the height of an element, it needs to be displayed as either a block or inline-block.
Centered text
div.centered-box { height:70px; line-height:70px; border:5px solid #000; }