Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How can i get the text on the bar?

My ul elements doesn’t go on top of the header. I tried to use position absolute and relative but then it’s messing up. ul should go on the background. Is it because of the logo? I just want a basic navbar. Please anyone that can help?


    @import url("https://fonts.googleapis.com/css2?family=Nunito:wght@800&display=swap");
    @import url("https://fonts.googleapis.com/css2?family=Fruktur&family=Nunito:wght@800&display=swap");
    
    * {
      margin: 0;
      padding: 0;
      color: white;
      list-style: none;
      text-decoration: none;
      box-sizing: border-box;
      font-family: "Nunito", sans-serif;
    }
    
    header {
      width: 100%;
      height: 60px;
      background-color: #141517;
    
      .Logo {
        width: 120px;
        margin-top: 15px;
        margin-left: 8px;
      }
    
      ul {
        text-align: center;
      }
    
      li {
        font-size: 15px;
        margin: 0 10px;
        line-height: 60px;
        display: inline-block;
      }
    }

Example with CSS

@import url("https://fonts.googleapis.com/css2?family=Nunito:wght@800&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Fruktur&family=Nunito:wght@800&display=swap");
* {
  margin: 0;
  padding: 0;
  color: white;
  list-style: none;
  text-decoration: none;
  box-sizing: border-box;
  font-family: "Nunito", sans-serif;
}

header {
  width: 100%;
  height: 60px;
  background-color: #141517;
}

header .Logo {
  width: 120px;
  margin-top: 15px;
  margin-left: 8px;
}

header ul {
  text-align: center;
}

header li {
  font-size: 15px;
  margin: 0 10px;
  line-height: 60px;
  display: inline-block;
}
<script src="https://kit.fontawesome.com/7ddb0129cc.js" crossorigin="anonymous"></script>

<body style="background-color: #202020">
  <header>
    <img class="Logo" src="Logo.svg" />
    <ul>
      <li><a href="#">Home</a></li>
      <li><a href="#">Developing</a></li>
      <li><a href="#">LeaderBoards</a></li>
    </ul>
  </header>

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

You need to use flexbox or grid, the two ways in css to create layouts. I used flexbox below to make it works. I also used css instead of scss juste to have it works here on Stack Overflow.

@import url("https://fonts.googleapis.com/css2?family=Nunito:wght@800&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Fruktur&family=Nunito:wght@800&display=swap");

* {
  margin: 0;
  padding: 0;
  color: white;
  list-style: none;
  text-decoration: none;
  box-sizing: border-box;
  font-family: "Nunito", sans-serif;
}

header {
  width: 100%;
  min-height: 60px;
  background-color: #141517;
  display:flex;
  align-items:center;
  justify-content : space-between;
}

 .Logo {
    width: 120px;
    margin-top: 15px;
    margin-left: 8px;
  }

  ul {
    text-align: center;
    display: flex;
  }

  li {
    font-size: 15px;
    margin: 0 10px;
    line-height: 60px;
    display: inline-block;
  }
<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" />
  <title>RoPoop</title>
  <link rel="shortcut icon" type="image/jpg" href="favicon.ico" />
  <link rel="stylesheet" href="CSS/IndexStyle.css" />
  <script src="https://kit.fontawesome.com/7ddb0129cc.js" crossorigin="anonymous"></script>
</head>

<body style="background-color: #202020">
  <header>
    <img class="Logo" src="Logo.svg" />
    <ul>
      <li><a href="#">Home</a></li>
      <li><a href="#">Developing</a></li>
      <li><a href="#">LeaderBoards</a></li>
    </ul>
  </header>
</body>

</html>
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading