Alignment Issues
Height difference??
by Sascha
HTML
<!DOCTYPE html>
<html lang="sv">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My Little Pony</title>
<!-- css -->
<link rel="stylesheet" href="css/main.css">
<!-- favicon -->
<link rel="shortcut icon" href="img/favicon.ico" type="image/x-icon">
<!-- fonter -->
<link href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;700&display=swap" rel="stylesheet">
</head>
<body>
<div class="left_div">
<img src="https://upload.wikimedia.org/wikipedia/en/thumb/b/b9/My_Little_Pony_G4_logo.svg/1200px-My_Little_Pony_G4_logo.svg.png" alt="My Little Pony Logo">
<a class="active" href="#">Home</a>
<a href="#">News</a>
<a href="#">Contact</a>
<a href="#">About</a>
</div>
</body>
</html>
CSS
html,
body {
font-family: 'Open Sans', sans-serif;
background-color: #efefef;
}
body{
margin: 0;
}
.left_div {
margin: 0;
padding: 0;
width: 25%;
background-color: #fff;
position: fixed;
height: 100%;
overflow: auto;
text-align: center;
}
.left_div img {
width: 50%;
height: auto;
margin: 2vh 0 2vh 0;
vertical-align: middle;
}
.left_div a {
display: block;
color: black;
background-color: rgb(217, 50, 141);
padding: 16px;
text-decoration: none;
width: 75%;
margin: 2vh auto;
border-radius: 5px;
color: rgb(255, 255, 255);
transition: all .2s ease-in-out;
}
.left_div a.active {
background-color: rgb(65, 29, 100);
color: white;
}
.left_div a:hover:not(.active) {
background-color: rgb(153, 22, 94);
color: white;
}
@media screen and (min-width: 765px) and (max-width: 968px) {
.left_div {
width: 100%;
height: auto;
position: relative;
text-align: left;
}
.left_div img {
width: 12.5%;
height: auto;
margin: 0 0 0 2vw;
}
.left_div a {
display: inline;
color: black;
background-color: rgb(217, 50, 141);
padding: 16px;
text-decoration: none;
margin: 0 auto;
border-radius: 5px;
color: rgb(255, 255, 255);
transition: all .2s ease-in-out;
}
}
@media screen and (max-width: 765px) {
.left_div {
width: 100%;
height: auto;
position: relative;
}
.left_div a {
text-align: center;
float: none;
}
}