center div horizontally and vertically
.parent {
position: relative;
}
.child {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
}
center div horizontally and vertically
.parent {
position: relative;
}
.child {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
}
how to center a div element
/*ADD MARGIN auto to left and right*/
.box1{
width:80%;
margin:0 auto;
}
html position div inside div
.textblock-container {
width: 500px;
height: 500px;
border: 1px solid red;
position: relative;
}
div.textblock {
width: 100px;
height: 100px;
line-height: 100px;
border: 1px solid black;
position: absolute;
text-align: center;
background: rgb(0, 150, 0);
background: rgba(0, 150, 0, .5);
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us