Steps for positioning the navigation bar beneath header 1

In my HTML code, here is a link to an image: https://i.sstatic.net/zhj7o.jpg

I have successfully completed the sections associated with this image: https://i.sstatic.net/wIE6N.png

However, I'm facing an issue now. I am unable to position the navigation bar ("Home About Us...") under the "Art Store" section using the div method as I tried before. The navigation bar keeps ending up in the wrong place, as seen here: https://i.sstatic.net/8FwrU.jpg

Here's a snippet of the HTML:

<html lang="en">
         <head>
          <meta charset="utf-8">
          <meta name="viewport" content="width=device-width, initial-scale=1.0">
          <title>Assignment 1 - Page 1</title>

          <link href="reset.css" rel="stylesheet">
          <link href="assign1.css" rel="stylesheet">

         </head>
      <body>
        <div class="navTop">
            <a href="#">My Account</a>
            <a href="#">Wish List</a>
            <a href="#">Shopping Cart</a>
            <a href="#">Checkout</a>
        </div>
       <div class="page1Tile">
        <h1>Art&nbsp;Store</h1>
      </div>
    <div class="page1SubNav">
        <ul>
            <li>NMSL</li>
            <li>CNM</li>
        </ul>
     </div>

   </body>
  </html>

CSS Snippet:

body {
              font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
              font-size: 14px;
             line-height: 1.428571429;
             color: #333333;
             background-image: url(images/stucco/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="0477707167676b5b44365c2a746a63">[email protected]</a>)
         }

        .navTop {
             height: calc( 40px + (50 - 40) * ( (100vw - 400px) / ( 800 - 400) ));
             line-height: calc( 40px + (50 - 40) * ( (100vw - 400px) / ( 800 - 400) ));
             background:black;
             margin: -8px -8px 0 -8px;
         }
    
         /* Additional CSS styles go here */
     

Answer №1

body {
   font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
   font-size: 14px;
   line-height: 1.428571429;
   color: #333333;
    background-image: url(images/stucco/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="82f1f6f7e1e1edddc2b0daacf2ece5">[email protected]</a>)
}

.navTop {
  height: calc( 40px + (50 - 40) * ( (100vw - 400px) / ( 800 - 400) ));
  line-height: calc( 40px + (50 - 40) * ( (100vw - 400px) / ( 800 - 400) );
  background:black;
  margin: -8px -8px 0 -8px;

}

.navTop a {
  margin-right: 4ex;
  color: grey;
  font-family: 'Calluna Sans', sans-serif;
  font-size: calc(6px + (18 - 12) * ( (100vw - 400px) / ( 800 - 400) ));
  text-decoration: none;
  float:right
}

.page1Tile{
    display: block;
    clear: both;
    font-size: 60px;
    
}

.page1SubNav nav{
    float:left;
}

.page1SubNav {
    height: calc( 40px + (50 - 40) * ( (100vw - 400px) / ( 800 - 400) ));
  line-height: calc( 40px + (50 - 40) * ( (100vw - 400px) / ( 800 - 400) ));
  background:white;
  margin: -8px -8px 0 -8px;
}

.page1SubNav li{
    float:left;
    text-decoration: none;
}

.page1SubNav li a{
    display: block;
  color: white;
  text-align: center;
  padding: 14px 16px;
  text-decoration: none;
}
<div class="navTop">
        <a href="#">My Account</a>
        <a href="#">Wish List</a>
        <a href="#">Shopping Cart</a>
        <a href="#">Checkout</a>
    </div>
<div class="page1Tile">
    <h1>Art&nbsp;Store</h1>
</div>
<div class="page1SubNav">
    <ul>
    <li>NMSL</li>
    <li>CNM</li>
    </ul>
    </div>

Deleting float:left from .page1Tile should resolve the issue

The inclusion of float left ensures that the width of the div is determined by the content it contains. Consequently, the content below Art store shifts upwards and causes overlap

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

The primary division containing two inner divisions, one centered and the other positioned to the right

I would like the layout to resemble the image provided. The div header contains two nested divs - the logo div should be centered, and the info div should be positioned to the right with some margin. ...

Unable to view form data in .php file

How can I change the style of my "Submit" button when a user clicks on it to submit the form? The action attribute calls a PHP file, but the data doesn't show up until I remove the onSubmit attribute from the form. However, without it, I cannot use t ...

html form-- assistance required in making new input area appear upon clicking radio button

Currently, I am in the process of creating a basic customer database using mysql and php. My goal is to have extra input fields appear for mailing address when users click on the radio button labeled "different mailing address". However, I'm unsure ab ...

Unique lightbox effect with multiple layers

Currently, I am working on implementing a lightbox effect to showcase images to the user using a GridView. Upon clicking an image, a new layer should appear above the current page displaying a larger version of the image along with some description. Althou ...

How can we centralize an image above text within a UL element?

Is there a way to achieve the effect shown in my mockup using just one unordered list (ul) instead of having separate ul elements for images and text? Essentially, I want to display an image with associated text below it within a single ul element using CS ...

Image Animation Using a Rotational Control (HTML/JavaScript/...)

I am interested in achieving a specific effect with a series of images that transition from dark to light. My idea is to have a dial or slider underneath or over the frame so that when it is moved to the left, the black image is displayed, and when moved t ...

How can I add a black-colored name and a red-colored star to the Placeholder Star as a required field?

I'm looking to customize the placeholder text in an input field. I want the main placeholder text to be in black and have a red star indicating it's a required field. However, my attempt to set the color of the star specifically to red using `::- ...

Display a button within a table depending on the content of adjacent cells

Below is the code snippet I'm currently working with: <tbody *ngIf="packages"> <tr *ngFor="let package of packages"> <td class='checkbox'> <label class="css-control css-co ...

Utilize a viewpoint alteration alongside a floating effect on a specific element

I thought this would be an easy task, but I seem to be missing something as it doesn't work for me. The goal is to use the perspective() and rotateY() functions in a transform to create a perspective effect on an element. Additionally, there should b ...

Tips for styling a datatable scrollbar with CSS

My preference is to utilize the datatable API when creating tables. $('#datatable-example').dataTable({ "scrollX": true, "info" : false, "fnDrawCallback" : function(oSettings) { $('td').removeClass('sor ...

Automatically changing the color of the navigation bar text

I am experiencing an issue with the navigation bar on my webpage. Currently, it is styled with white text against a dark background color using the following CSS code snippet: a{ color: white; text-decoration:none; font-weight:bold; font-s ...

Hide in certain zones, contextual menu

I recently discovered how to create my own context menu with links based on the div clicked (check out here for more details). However, I am facing an issue now. I am struggling to prevent the context menu from appearing above the specific div boxes where ...

Strategies for handling user typos in a JavaScript prompt

Hi there! Just wanted to say that I'm new to this website, so please forgive any posting mistakes I might make. I'm currently taking a web technology class where we're learning JavaScript. In a previous lesson, we covered HTML5 and CSS. Our ...

The issue with Angular-gettext is that it fails to update dynamically generated strings in the code

Whenever I try to set the language using the code gettextCatalog.setCurrentLanguage(langString);, it doesn't seem to affect my side-nav menu. My side menu has two possible states: expanded or collapsed, and I use ng-include to control its content base ...

having difficulty with an intricate flexbox grid within another flexbox

I attempted to create a grid-like pattern using a negative margin based grid system (Susy) but was unsuccessful. Next, I tried employing flexbox for the task. However, I'm unsure if it's achievable. My initial idea was to have 2 columns (side A ...

What is the best way to generate a JSON object with Angular and showcase its content through HTML?

Currently, I am dealing with a JSON object that is completely unfamiliar to me. Without knowing the keys or values of this object, I was able to successfully manipulate it and extract the necessary information. Ultimately, I have generated an array (whic ...

Logging DOM elements with Electron's webview preload feature

Within my Electron program, I am utilizing a webview in my index.html file. The webview is equipped with a preloader, and my goal is to manipulate the DOM of the webview specifically, not just the index.html file. In my preloader code snippet below, the c ...

Is it possible that adding html tables together could result in the numbers being concatenated instead of summed?

When attempting to calculate the total sum of values in an html table column, my variable seems to be returning concatenated strings instead of the actual sum. For example, instead of 1 + 2 + 3 = 6, I am getting 1 + 2 + 3 = 123. The values in the "votes" ...

Here is a step-by-step guide on how to use JavaScript to eliminate the page title, URL, date and

When printing a page using window.print, is there a way to exclude the page title, URL, page number, and date/time from appearing? ...

What is the best way to combine items from two separate lists into a single list by simply clicking on the items using JavaScript and PHP?

Having encountered some issues with setting up a list of items and moving them between each other, I was wondering if it is possible to have multiple lists with a link inside each item that allows for moving it to a specified list. For example, having a li ...