What are the steps to create a navbar positioned below an image?

I have my navbar on another page, but I would like to center it directly under the logo or image. My align-items property doesn't seem to work, so I've had to set the height in the .logo class. Is there any other method I can use to achieve this?

<header class="header" id="header">
        <div class="logo">
            <img src="img/logo/logo.png" alt="Logo Fim Produkcji">
        </div>
        <nav class="nav__menu">
            <ul>
                <li><a href="#faq__section">FAQ</a></li>
                <li><a href="#contact__section">Kontakt</a></li>
                <li><a href="#gallery__section">Portfolio</a></li>
            </ul>
        </nav>
    </header>

original codepen link

css

*{
 margin:0;
 padding: 0;
box-sizing: border-box;
 font-family: sans-serif;      
}
.header, .gallery__section{
  height: 100vh;
}
.gallery__section{
    background-image: url(https://picsum.photos/1920/1080);
}
header{
   background-image: url(https://picsum.photos/1920/1080);
  background-repeat: no-repeat;
    background-size: cover;
  background-position: center;
}
.logo{
  display: flex;
    justify-content: center;
  align-items: center;
  height: 100%;
}
.logo img{
  max-width: 200px;
 width: 100%;
 height: auto;
}
.nav__menu{
   display: flex;
   justify-content: center;
    align-items: center;
}
.nav__menu ul li {
 display: inline-block;
}

Answer №1

Simply set the image's position to fixed and everything should function correctly

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

What is the reason .navbar-dark is not functioning in Bootstrap v5.2?

I am puzzled by the fact that navbar-dark is not changing the text color in the nav. I'm not sure why this is happening. Any insights would be greatly appreciated! <!doctype html> <html lang="en"> <head> <meta charset=" ...

Retrieving precise content from a span tag using Python (BeautifulSoup)

Currently in the process of web scraping MyAnimeList with BeautifulSoup on Python3 to extract data about the 'Status' of a particular show, but encountering issues with accessing the desired information. Below is the snippet of HTML: <h2>I ...

Having trouble adding two controller.js files to the same HTML page. The error message "Argument {mycontroller} is not a function, got undefined" keeps popping up

I recently started learning Angular and I'm facing a challenge with nested Angular controllers. I have stored all the controllers in separate .js files. The main controller on my webpage needs to include another controller called 'UploadControll ...

Retrieve the content outside of the quotation marks in an HTML document through web scraping

I need help extracting specific information from a web page using Python. The data I want is not within quotation marks, as shown below: nummber = page_soup.findAll("span", {"id": "referenznummer"}) nummber # result [<span ...

Tips for ensuring the list stays perfectly centered within the navigation bar when placed among three images

I have my navigation bar set up with the logo on the far left and two flags for English and Italian on the far right. The issue I'm facing is that the UL element, being a block element, pushes the flags onto the next line. However, I want the UL to be ...

Develop an XML document that includes CSS and DTD seamlessly incorporated

Could someone please provide me with a short code example of an XML file that includes both a DTD and CSS styles all in one file? Just need one element as an example. I'm new to XML and can't seem to find any examples with both XML and CSS comb ...

Challenges with implementing TailwindCSS classes in a Next.js application

I've encountered some issues in my nextJS app with utilizing certain TailwindCSS classes such as top, left, or drop-shadow. Even after attempting to update Tailwind from version 1.9.5 to 3.3.3, I have not seen any changes. I believe that I am import ...

What is the best way to add a background to text that has been wrapped?

How can I achieve a background effect for text that is wrapped within a container using CSS? Is it possible to do this by referring to an image like this: . ...

Encountered an issue in GoJS with Angular 4: ERROR TypeError: Unable to access property 'class' of null at Function.F.fromJson.F.fromJSON

I have just started exploring GoJS and decided to create a sample project by utilizing the Kanban sample available on the GoJs website. I attempted to use Angular and Typescript for this, but encountered an error. AppComponent.html:1 ERROR TypeError: Cann ...

How can I create a clickable <div> element containing multiple links and trigger only one action?

Within my code, there is a <div> element that has been made clickable. Upon clicking this <div>, the height and text expand using the jQuery function $(div).animate();. While this functionality works as intended, I am encountering a slight issu ...

The inclusion of a content editable feature within a carousel is leading to unexpected event propagation

I am dynamically creating an editable div using the code snippet below. <div class='reflection-field' contenteditable="true" data-number="${index}"></div> Expected Outcome: When I click on the generated div, I anticipate that the c ...

Alignment of Bootstrap responsiveness shifted to the left rather than the center

My HTML Code: <div class="gridrow" id="eventsrow"> <div class="gridcard" id="eventcard" style="float:left;width:100%;height:100%;margin-bottom:0.5rem;background-color:white"> <div class="event container"> <div clas ...

Using Angular expressions, you can dynamically add strings to HTML based on conditions

I currently have the following piece of code: <div>{{animalType}}</div> This outputs dog. Is there a way to conditionally add an 's' if the value of animalType is anything other than dog? I attempted the following, but it did not ...

Translate a portion of a painting by utilizing context.putImageData()

I am attempting to gradually fill a canvas with pieces of the original image. To achieve this, I need each square of the image to be filled in iteratively on the canvas. To optimize performance, my approach involves rendering the original image onto an of ...

XSLT: Tips for preventing the use of self-closing tags within HTML attributes

I am new to XSLT and I'm currently troubleshooting an issue with some XSLT code (version 2.0) that was written a few years ago. Here is a snippet of the XSLT code: <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" ...

The arrangement vanishes when using identical html/css coding

When using the same HTML/CSS coding, the layout disappears and appears misaligned on one page but works perfectly on another. The issue seems to be that the first section of the main area is getting a width of 938px instead of 5px. I've tried adding w ...

Aligning multiple 'divs' horizontally with different lengths of text

I have a set of 3 identical divs with fixed width. Each contains text of varying lengths and another nested div that is aligned to the right using float. When the text lengths are equal, they align perfectly. However, when the text lengths differ, the ali ...

Why doesn't the style show up when JavaScript is turned off with Material UI, CSS Modules, and Next.js?

This is my first time diving into Material UI, CSS Modules, and Next.js with a project. Issue: I noticed that when I disable JavaScript in the Chrome DevTools, the styles are not being applied. I'm not sure if this has something to do with Materia ...

What could be causing the malfunction of this JavaScript dropdown select feature in Internet Explorer?

I created a website that requires users to input their location, including the city and state. The process involves two dropdown menus: - The first dropdown menu, labeled "state," loads all USA states as selectable options when the website is loaded. This ...

Stop elements from overextending within their parent container

I am facing an issue with two divs that are wrapped inside a container div. The bottom div contains a dynamically filled table, which determines the overall width of all the divs. On the top div, I want to display several small red blocks that need to tak ...