How to achieve Vertical in css Picture
This article will explain in detail how to achieve vertical css pictures, the editor thinks it is very practical, so share it for you to do a reference, I hope you can get something after reading this article.
Vertical-align attribute
We use the text-align property to define the horizontal alignment of the image.
Everyone began to have questions, the picture horizontal alignment we achieved, what if you want to align the picture vertically?
In CSS, we can use the vertical-align property to define the vertical alignment of the picture.
Syntax: vertical-align: attribute value
Vertical-align also has some attribute values such as sub, super, and so on, which we don't need to pay attention to, because they are not used at all in actual development. All we need to do is use the above four attribute values.
Example 1:
Vertical-align attribute
Img {width:80px;height:80px;}
# img_1 {vertical-align:top;}
# img_2 {vertical-align:middle;}
# img_3 {vertical-align:bottom;}
# img_4 {vertical-align:baseline;}
Php Chinese website php Chinese website (top)
Php Chinese website php Chinese website (middle)
Php Chinese website php Chinese website (bottom)
Php Chinese website php Chinese website (baseline)
The effect is as follows:
Wechat screenshot _ 20181112155823.png
Take a closer look. There is a difference between "vertical-align:baseline" and "vertical-align:bottom".
Example 2:
Vertical-align attribute
Div
{
Width:100px
Height:80px
Border:1pxsolidgray
}
.div _ img1 {vertical-align:top;}
.div _ img2 {vertical-align:middle;}
.div _ img3 {vertical-align:bottom;}
Img {width:60px;height:60px;}
This is the end of this article on "how to achieve vertical css pictures". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it out for more people to see.