I've seen a post regarding my problem, but the results didn't fully satisfy me, so please don't consider this as a duplicate.
Basically, in the post I linked, @Web_Designer is explaining how to keep the div
in the window viewport
and resize it while keeping the 16:9 (in my case) aspect ratio. I'm making a kind of presentation website though, and while the slides keep proper aspect ratio, the site is scrollable (vertically) which is not good because I want it to reduce height so the entire slide would fit in the view. While I enable fullscreen though, there is no problem and scroll bars "disappear".
A quick explanation of my code:
.container
is a container containing the whole presentation
.presentation-place
is a div containing all the slides, we can consider it as our main subject.
.slide
is a class containing slides which has nothing to do with what I'm trying to achieve.
body {
background: black;
user-select: none;
margin: 0;
}
.container {
box-sizing: border-box;
resize: both;
overflow: auto;
max-width: 100%;
height: 100vh;
}
.presentation-place {
user-select: none;
background: white;
display: inline-block;
width: 100%;
margin: 0;
position: absolute;
padding-bottom: 56.25%;
}
.slide {
position: absolute;
top: 0;
bottom: 0;
margin: 0;
width: 100%;
height: 100%;
overflow: hidden;
background: red;
}
<body>
<div class="container">
<div class="presentation-place">
<div class="slide">
<h1>Test slide</h1>
</div>
</div>
</div>