+ 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...
5 Réponses
+ 1
https://css-tricks.com/centering-css-complete-guide/
unless you wanted something different...
+ 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 .
+ 1
top: 50%
transform: translateY(-50%)
0
Exampl:
center {
padding: 70px 0;
border: 3px solid green;
}