Tips for positioning a website's name above navigation links in a header | Using HTML and CSS

I need assistance in placing the website name above the navigation bar on my webpage. I have included HTML and CSS codes below.

The {load static} command within the HTML code loads CSS files in a Django project, but in this case, there is no Django involved, just visual styling using HTML and CSS.

If you have any queries, feel free to ask me!

Here is my HTML code:

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

li, a {
  font-weight: 500;
  font-size: 16px;
  color: #edf0f1;
  text-decoration: none;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 30px 10%;
  background-color: #24252A;
  justify-content: center;
}

.nav__logo {
  justify-content: center;
  text-align: center;
}

.nav__links{
  list-style: none;
}

.nav__links li {
  padding: 0px 20px;
  display: inline;
  margin-right: 60px;
}

.nav__links li a {
  transition: all 0.3s ease 0s;
}

.nav__links li a:hover {
  color: #008Ba9
}
<!DOCTYPE html>
<html lang="en" dir="ltr">
  <head>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta charset="utf-8">
    {% load static %}
    <link rel = "stylesheet" href="{%  static  'css/styles.css'  %}">
    <title>{% block title %} {% endblock %}</title>
  </head>
  <body>
    <header>
      <a class= "nav__logo" href="#">Rose</a>
      <nav>
        <ul class="nav__links">
          <li><a href="#">Women</a></li>
          <li><a href="#">Deals & Contests</a></li>
          <li><a href="#">Gifts</a></li>
        </ul>
      </nav>
    </header>
  </body>
</html>

And here is my CSS code:

Answer №1

Do you find this acceptable, or would you prefer something else?

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;


}

li, a {
  font-weight: 500;
  font-size: 16px;
  color: #edf0f1;
  text-decoration: none;
}

header{
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 30px 10%;
  background-color: #24252A;
  justify-content: center;

}

.nav__logo {
  justify-content: center;
  text-align: center;


}

.nav__links{
  list-style: none;


}
.nav__links li {

  padding: 0px 20px;
  display: inline;
  margin-right: 60px;


}

.nav__links li a {
  transition: all 0.3s ease 0s;
}

.nav__links li a:hover {
  color: #008Ba9
}
<!DOCTYPE html>
<html lang="en" dir="ltr">
  <head>


    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta charset="utf-8">
    {% load static %}
    <link rel = "stylesheet" href="{%  static  'css/styles.css'  %}">
    <title>{% block title %} {% endblock %}</title>

  </head>
  <body>
  <h1>heading</h1>
    <header>
    
      <a class= "nav__logo" href="#">Rose</a>
      <nav>

        <ul class="nav__links">
          <li><a href="#">Women</a></li>
          <li><a href="#">Deals and Contests</a></li>
          <li><a href="#">Gifts</a></li>

        </ul>
      </nav>
    </header>
  </body>
</html>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

How can I create a hover effect for a span element using html and css?

I have encountered an issue with hover color in span classes. I managed to successfully create two classes on this page, but the hover effect is not working on other classes. To troubleshoot, I included a link to my test page below. Can you please review i ...

Issue with bootstrap-selectpicker not updating the width of the selection box

I've been attempting to adjust the width of the selectpicker box that displays selected options, but so far all my efforts have been fruitless. I can't seem to change the width or color of the box. If anyone has any ideas or suggestions, they wo ...

Parenting and Child Components: Keeping the State in Sync

I am currently diving into my initial React project which focuses on a basic expense tracker for credit cards. While I'm still in the learning phase, I hope you can decipher the intent behind my code. My current roadblock involves mapping the state an ...

Excessive margin-left values for CSS div positioning are simply outlandish

http://jsfiddle.net/SVJaK/1338/ I attempted to create a small space between the green divs and my right div in this fiddle. I had to specify a very large pixel margin-left value to achieve that slight gap. Can someone explain why? Even though the gap is a ...

Changing the content of a form with a personalized message

I am currently working on a Feedback modal that includes a simple form with fields for Name, rating, and comment. After the user submits the form, I intend to display a custom message such as "Your feedback has been submitted." However, I am facing an issu ...

Is it possible to shift an HTML background using jQuery's animate method?

My website has a unique background image through CSS, creating the look of a blueprint schematic with a white grid on a blue background. CSS: html { display: block; position: absolute; background: url(../assets/background.jpg) repeat; col ...

Order of execution in Single Page Applications when using multiple files: understanding the Javascript async defer concept

I am currently working on enhancing the performance of my webpage, which is built using EmberJS. One strategy I'm considering is utilizing `asyc` and `defer` attributes for our Javascript files. I have already implemented other optimizations such as ...

Is it possible to achieve avoidance of width calculation using only CSS?

Check out this link for more information. For a working version, visit: this site. The issue here is that Angular is calculating the width of the slider when the directive is processed, but since the item is not visible, it has no width. The labels on th ...

What is the best way to position a sidebar alongside content using flexbox?

As a newcomer to web development, I recently attempted to use flexbox for the second time while working on the layout for my website. However, I encountered an issue with trying to float aside next to content. Despite my efforts, it seems to just disappear ...

Disappearing text with HTML Bookmark and CSS Overflow:Hidden - What's happening?

Within the header of my webpage, there is an image div that has been styled with overflow:hidden. Inside the content section, I have a bookmark anchor tag: <a name="arghargh"></a> Located at the top of the content area, there is a link that ...

Mastering the art of blending images seamlessly for a captivating cross-fading effect

I'm attempting to create an image cross fade effect using the following steps: Place the selected image in the front (position: -9999 to 0) Position the previous image in the back (position: 0 to -9999) Gradually increase the opacity of the selected ...

Ways to update the div's appearance depending on the current website's domain

There is a piece of code that is shared between two websites, referred to as www.firstsite.com and www.secondsite.com The goal is to conceal a specific div only when the user is on secondsite. The access to the HTML is limited, but there is an option to ...

The I am facing an issue with Material-ui Grid where the width of the Grid item is too large and extending beyond the boundaries

I'm in the process of setting up a basic layout for a single-page application using Material-ui and React. My plan is to have a sidebar on the left-hand side and a main area on the right-hand side to display information. However, I am facing two issue ...

The inline feature of the Bootstrap input group addon is not being utilized

Check out my code snippet here: http://www.bootply.com/iR1SvOyEGH <form> <div class="form-group"> <label for="inputEmail">Company Name</label> <input type="text" class="form-control"> <span class="input-gro ...

Tips for adjusting the height of a fixed-size child element on the screen using only CSS and JavaScript restrictions

I am faced with a challenge involving two child elements of fixed size: <div class="parent"> <div class="static_child"> </div> <div class="static_child"> </div> </div> .parent { border: 1px solid black; dis ...

Implementing CSS and HTML in Email Communication

I'm noticing a difference between how this appears in a browser versus an email. The text on the image looks perfect when viewed on Mozilla/Chrome, but when I use the same code in an email, the text ends up displaced below the image (right beneath it) ...

Tips for passing values and their corresponding labels during a click event in Angular 4

When I click the plus button, I want to hide the li element. Even though the data is passing correctly, the li element is not clearing as expected. The desired outcome is for the li instance to be removed once the plus button is clicked. https://i.stack.im ...

Ensure the div element remains fixed at the top of the page

I created a script to identify when I reach the navigation bar div element and then change its CSS to have a fixed position at the top. However, I am encountering an issue where instead of staying fixed, it jumps back to the beginning of the screen and fli ...

CSS: The Ultimate Guide to Fixing Your Footer at the Bottom of Your Page

My goal is to anchor the Footer to the bottom of the page. I attempted to achieve this by using Absolute positioning in CSS, as suggested in similar discussions. However, the footer seems to be behaving like a Fixed element rather than Absolute. html, b ...

An issue with jQuery and LESS causing stylesheets to update only once

Struggling with updating a custom CSS href - everything works perfectly the first time, but subsequent updates do not reflect any changes on the page. Even though I can see the href updating in Chrome debugger and there are no errors being thrown by LESS, ...