Hello everyone,
I'm currently working on a web project and I'm having trouble positioning a video element below my navigation bar in a responsive manner. No matter what I try, I can't seem to get it right.
Here's what I've attempted so far:
<!DOCTYPE html>
<html lang="sv">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Digital Symphony</title>
<link rel="icon" href="ikon.jpg">
<link rel="stylesheet" href="tickets.css">
<script src="script.js"></script>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?f...amily=Shantell+Sans:wght@300;500&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?f...amily=Shantell+Sans:wght@300;500&display=swap" rel="stylesheet">
</head>
<body>
<!-- Meny -->
<nav class="navigation">
<ul>
<li><a href="#home">Hem</a></li>
<li><a href="#contact">Kontakt</a></li>
<li><a href="#gallery">Galleri</a></li>
<li><a href="#tickets">Turnéplan</a></li>
<li><a href="#music" class="active">Vår musik</a></li>
</ul>
</nav>
<!-- Introvideo -->
<div class="hero">
<video autoplay muted loop playsinline>
<source src="video.mp4" type="video/mp4">
</video>
</div>
<!-- Sidfot -->
<footer>
<div>
<p>Digital Symphony Autumn Tour -25</p>
</div>
<div>
<p>Kontakt: [email protected]</p>
</div>
</footer>
</body>
</html>
html, body {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
font-family: "Orbitron", sans-serif;
background-color: #0D0D0D;
background-image: url(bakgrundsbild1.jpg);
background-size: cover;
background-repeat: no-repeat;
display: flex;
flex-direction: column;
}
/* Typsnitt */
.press-start-2p-regular {
font-family: "Press Start 2P", system-ui;
font-weight: 400;
font-style: normal;
}
/* Meny */
.navigation {
background-color: #0D0D0D;
padding: 1em 0;
overflow: hidden;
width: 100%;
position: relative;
z-index: 1;
margin-bottom: -10px; /* Justera eventuellt för att eliminera mellanrummet */
}
.navigation ul {
list-style: none;
padding: 0;
margin: 0;
display: flex;
justify-content: flex-end;
}
.navigation li {
margin: 0 1em;
}
.navigation li:first-child {
margin-right: auto;
}
.navigation a {
text-decoration: none;
color: #FF6EC7;
padding: 1em;
display: block;
}
.navigation a:hover,
.navigation a.active {
background-color: #FFD700;
color: #FF6EC7;
border-radius: 0.8em;
}
/* Introvideo */
.hero {
position: relative;
width: 100%;
height: calc(100vh - 60px); /* Justera eventuellt höjden beroende på navigationens höjd */
overflow: hidden;
margin-top: -10px; /* Justera eventuellt för att eliminera mellanrummet */
}
video {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
object-fit: cover;
transform: translate(0, 0);
}
/* Footer */
footer {
background-color: #0D0D0D;
color: #FF6EC7;
padding: 1em;
text-align: center;
margin-top: auto;
}
I'm currently working on a web project and I'm having trouble positioning a video element below my navigation bar in a responsive manner. No matter what I try, I can't seem to get it right.
Here's what I've attempted so far:
<!DOCTYPE html>
<html lang="sv">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Digital Symphony</title>
<link rel="icon" href="ikon.jpg">
<link rel="stylesheet" href="tickets.css">
<script src="script.js"></script>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?f...amily=Shantell+Sans:wght@300;500&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?f...amily=Shantell+Sans:wght@300;500&display=swap" rel="stylesheet">
</head>
<body>
<!-- Meny -->
<nav class="navigation">
<ul>
<li><a href="#home">Hem</a></li>
<li><a href="#contact">Kontakt</a></li>
<li><a href="#gallery">Galleri</a></li>
<li><a href="#tickets">Turnéplan</a></li>
<li><a href="#music" class="active">Vår musik</a></li>
</ul>
</nav>
<!-- Introvideo -->
<div class="hero">
<video autoplay muted loop playsinline>
<source src="video.mp4" type="video/mp4">
</video>
</div>
<!-- Sidfot -->
<footer>
<div>
<p>Digital Symphony Autumn Tour -25</p>
</div>
<div>
<p>Kontakt: [email protected]</p>
</div>
</footer>
</body>
</html>
html, body {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
font-family: "Orbitron", sans-serif;
background-color: #0D0D0D;
background-image: url(bakgrundsbild1.jpg);
background-size: cover;
background-repeat: no-repeat;
display: flex;
flex-direction: column;
}
/* Typsnitt */
.press-start-2p-regular {
font-family: "Press Start 2P", system-ui;
font-weight: 400;
font-style: normal;
}
/* Meny */
.navigation {
background-color: #0D0D0D;
padding: 1em 0;
overflow: hidden;
width: 100%;
position: relative;
z-index: 1;
margin-bottom: -10px; /* Justera eventuellt för att eliminera mellanrummet */
}
.navigation ul {
list-style: none;
padding: 0;
margin: 0;
display: flex;
justify-content: flex-end;
}
.navigation li {
margin: 0 1em;
}
.navigation li:first-child {
margin-right: auto;
}
.navigation a {
text-decoration: none;
color: #FF6EC7;
padding: 1em;
display: block;
}
.navigation a:hover,
.navigation a.active {
background-color: #FFD700;
color: #FF6EC7;
border-radius: 0.8em;
}
/* Introvideo */
.hero {
position: relative;
width: 100%;
height: calc(100vh - 60px); /* Justera eventuellt höjden beroende på navigationens höjd */
overflow: hidden;
margin-top: -10px; /* Justera eventuellt för att eliminera mellanrummet */
}
video {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
object-fit: cover;
transform: translate(0, 0);
}
/* Footer */
footer {
background-color: #0D0D0D;
color: #FF6EC7;
padding: 1em;
text-align: center;
margin-top: auto;
}