Set the line height and create a gap between the text and the border. but this is not the best practice. because the line height is not intended to create a field or fill. It is intended to create a gap between two text lines (a gap between two lines of a paragraph).
So, for your task to be completed, you need to place a margin or addition. The best option is to add margin (but this is not alignment, just point the margin up). Also add text to the p tag or span tag (regardless of the tag that can be used to wrap text).
HTML code
<ul> <li><span>Hello</span></li> <li><span>Bye Bye</span></li> <li><span>Ciao</span></li> </ul>
CSS code
ul li span { margin-top: 5px; }
If vertical alignment is required, here is the code.
ul li { position: relative; } ul li span { position: absolute; top: 50%; font-size: 12px; line-height: 12px; margin-top: -6px; }
Eranga Kapukotuwa Jul 01 '14 at 6:29 2014-07-01 06:29
source share