How to VERTICALLY ALIGN block elements in HTML? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How to VERTICALLY ALIGN block elements in HTML?

I know how to vertically align inline elements in html but i didn't got the same for the block elements...

2nd Dec 2018, 12:37 PM
Parth
Parth - avatar
5 Answers
+ 1
https://css-tricks.com/centering-css-complete-guide/ unless you wanted something different...
2nd Dec 2018, 3:38 PM
Janningā­
Janningā­ - avatar
+ 2
Using css display property. Example. Let's take a paragraph <Html> <head> <style> p { display:inline; </head> <body> <p> first paragraph </p> <p> second paragraph</p> </body> </html> with display property u can display inline elements as block elements and vice versa. display property has three values display:inline display:block display:inline-block refer the course for more .
14th Dec 2018, 9:47 PM
Me&You
Me&You - avatar
+ 1
top: 50% transform: translateY(-50%)
4th Dec 2018, 6:21 PM
Reza Aghajani
Reza Aghajani - avatar
2nd Dec 2018, 3:41 PM
Janningā­
Janningā­ - avatar
0
Exampl: center { padding: 70px 0; border: 3px solid green; }
16th Dec 2018, 3:20 AM
Aishatu hamidu saidu
Aishatu hamidu saidu - avatar