The vertical-align property specifies the vertical alignment.
The vertical alignment of the image can be specified by applying this property to the IMG element.
#example {
vertical-align: middle;
}
Property |
Value |
Explanation |
vertical-align |
baseline |
aligns to the baseline of the parent element (default) |
top |
aligns to the top of the line |
text-top |
aligns to the top of the parent element's font |
middle |
aligns to the middle of the line |
bottom |
aligns to the bottom of the line |
text-bottom |
aligns to the bottom of the parent element's font |
length |
raises or lowers the element by the length baseline = 0 positive value : raises negative value : lowers |
% |
raises or lowers the element by the percentage baseline = 0% (100% = one line-height) positive value : raises negative value : lowers |
- About the baseline
Example