How To Set An Element Horizontal & Vertical Align Center-CSS Layout ?

Want to an element horizontal & vertical element ? This article is for you.

A Article’s cover photo which is showed align center
source: https://scotch.io/

Hey, Hey….

In this article ,

Type 1: Today I am going to talk about to set an element horizontal & vertical align center. Let’s look in code.

<div style=" padding: 70px 0;border: 3px solid green;text-align: center;width: 50%;margin:auto;"><form name="myform" method="post" action="#" onsubmit="return validateemail();">
Email:
<input type="text" name="email"><br />
<input type="submit" value="register"></form></div>

Output of the code:

vertically and horizontally align center

Type 2: Here is second type of code.

<div style="display: flex;justify-content: center;align-items: center;height: 200px;width:100%;border: 3px solid green;overflow: hidden;">Keep patience</div>

Output of this code:

vertically and horizontally align center with full width

So, how was the whole article, comment below. stay connected to get more tricks.

--

--