I want to scale and center this div
element to look good on all screens. I tried height:x%
but it doesn't work. Only scaling it with px
works. Any ideas why?
body {
text-align: center;
}
div {
display: block;
justify-content: center;
margin: auto;
border-radius: 25px;
height: 100px;
width: 50%;
background-color: aqua;
}
<html>
<head>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div>
<h1>Sample</h1>
</div>
</body>
</html>