css transform center

124

css transform center -

<body>
	<div class="my-div">Centered text</div>
<style>
  .my-div {
    position: absolute;
    top: 50%; right: 50%;
    transform: translate(50%,-50%);
  }
</style>
</body>

Comments

Submit
0 Comments