Trying to create a slider that aligns both horizontally and vertically can be a tricky task. To achieve this alignment, I have implemented the use of display: flex;
within the following code:
body {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
height: 100%;
}
<div id="slider">
the content
</div>
My goal is to position the div in the center of the screen, but without specifying a specific height for the body, I am facing some challenges. Should I resort to using height: 100vh;
, or is there a more optimal solution available?