body {
margin: 0;
background-color: white;
background: linear-gradient(to right, #000000, #ffffff, #ffffff, #000000);
line-height:25px;
}
h2{
color: black;
text-align: center;
display: block;
font-family: 'Montserrat', sans-serif;
padding-left: 14px;
font-size: 16px;
text-decoration: none;
font-weight: normal;
background-color: orange;
}
p{
margin: auto;
width: 32%;
color: black;
text-align: left;
font-family: 'Montserrat', sans-serif;
padding-bottom: 14px;
font-size: 12px;
text-decoration: none;
}
form{
margin: auto;
width: 32%;
color: black;
text-align: left;
font-family: 'Montserrat', sans-serif;
font-size: 12px;
text-decoration: none;
font-weight: bold;
}
input[type=text], select {
display: block;
margin: 8px 0;
}
input[type=date], select {
display: block;
margin: 8px 0;
}
input[type=submit], select {
margin-left: 50%;
margin-top: 10%
}
.nadpis{
color: black;
text-align: center;
display: block;
font-family: 'Montserrat', sans-serif;
padding-left: 14px;
font-size: 32px;
text-decoration: none;
font-weight: bold;
}
<!DOCTYPE html>
<html lang="cs">
<head>
<title>Hlavní stránka</title>
<link rel='icon' href='favicon.ico?' type='image/x-icon'/>
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Montserrat&display=swap" rel="stylesheet">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style></style>
</head>
<body>
<h1 class="nadpis">Vítejte v online dotazníku</h1>
<h2>Vyplnění tohoto formuláře pomůže mé práci</h2>
<br>
<form action="https://youtu.be/dQw4w9WgXcQ">
<label>
Jméno:<input type="text" name="jmeno" required />
</label>
<label>
Příjmení:<input type="text" name="prijmeni" required />
</label>
Pohlaví:
<br>
<input type="radio" name="pohlavi" value="muz" required>
<label for="muz">Muž</label><br>
<input type="radio" name="pohlavi" value="zena">
<label for="zena">Žena</label><br>
<label>
Datum narození:<input type="date" name="narozeniny" required />
</label>
<h2>Teď k Vašim preferencím</h2>
Kde všude hrajete hry:
<br>
<input type="checkbox" name="pc" value="pc">
<label for="pc">Počítač</label><br>
<input type="checkbox" name="konzole" value="konzole">
<label for="konzole">Konzole</label><br>
<input type="checkbox" name="mobile" value="Telefon">
<label for="mobile">Telefon</label><br>
Jak moc jste spokojeni s vládními opatřeními:
<br>
<label>
<input type="range" name="spoko" min="0" max="50" required>
</label><br>
Vyberte vaši oblíbenou barvu:
<br>
<label>
<input type="color" name="barva">
</label>
<br>
<input type="submit" value="Submit">
</form>
</body>
</html>
I am working on a form page for my school project and I want it to look better. Although the code is completed, I am facing issues with the styling. The first H2 has the whole page background color while the H2 in the form has the text only on the white background of the page. Any tips or suggestions on improving the appearance of the form are appreciated. Thank you.