Issue
I'm attempting to make the social logos on the same line as the "APKHub" text. I have tried aligning it properly and messed with positionings but nothing has been working. I am unsure why It is like this and I run into this issue a lot and haven't really found a fix. All the code is below and an image aswell.
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://kit.fontawesome.com/dd13dde450.js" crossorigin="anonymous"></script>
<!-- Fonts -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Roboto&display=swap" rel="stylesheet">
<!-- -->
<title>APKHub - Free APK Downloads</title>
</head>
<body>
<div class="navbar">
<h1>APKHub</h1>
<div class="links">
<i class="fa-brands fa-discord"></i>
<i class="fa-brands fa-twitter"></i>
<i class="fa-brands fa-telegram"></i>
</div>
</div>
</body>
<style>
body {
margin: 0;
padding: 0;
background-color: #141523;
}
.navbar {
border-radius: 5px;
padding: 10px;
background-color: #1d1e31;
}
.navbar h1 {
margin-left: 5px;
font-family: 'Roboto', sans-serif;
color: white;
}
.links {
text-align:right;
}
.links i {
font-size: 30px;
}
</style>
</html>```
Solution
just add to .navbar
display: flex;
- Places elements in flexbox form
justify-content: space-between;
- Positions the elements horizontally with space between them
align-items: center;
- Places the elements vertically in a balanced way
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://kit.fontawesome.com/dd13dde450.js" crossorigin="anonymous"></script>
<!-- Fonts -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Roboto&display=swap" rel="stylesheet">
<!-- -->
<title>APKHub - Free APK Downloads</title>
</head>
<body>
<div class="navbar">
<h1>APKHub</h1>
<div class="links">
<i class="fa-brands fa-discord"></i>
<i class="fa-brands fa-twitter"></i>
<i class="fa-brands fa-telegram"></i>
</div>
</div>
</body>
<style>
body {
margin: 0;
padding: 0;
background-color: #141523;
}
.navbar {
border-radius: 5px;
padding: 10px;
background-color: #1d1e31;
display: flex;
justify-content: space-between;
align-items: center;
}
.navbar h1 {
margin-left: 5px;
font-family: 'Roboto', sans-serif;
color: white;
}
.links {
text-align:right;
}
.links i {
font-size: 30px;
}
</style>
</html>
Answered By - Haim Abeles
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.