Is there a way to include text beneath the navigation bar and other elements on the page?

I am stuck trying to add some text below my header and navigation bar. Here is the code I've been working with:

<!DOCTYPE html>
<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">
        <link rel="stylesheet" href="styles.css">
        <title>How to use the Print Tool</title>
    
    </head>
    
    <body>
        <div>
<header>
            <a href="https://ecj.com.jm/"> <img src="../img/ecjLogo.png"  id="logo"> </a>
            <div class="name"> Business</div>

            <input type="checkbox" id="menu-bar">
            <label fr="menu-bar">Menu</label>

            <nav class="navbar">
                <ul>
                    <li> <a href="#">Application</a></li>
                    <li> <a href="#"> Help </a></li>
                    <li> <a href="#"> About </a></li>
                    <li> <a href="#"> Contact </a></li>
                </ul>
            </nav>


        </header>

        </div>
        

 <div>
    <h1>Geographic Information Systems (GIS) Department - ECJ Web Map Ver. 2.0 </h1>

<p> hello

 </div>
</p>
       
    </body>
</html>

*{
    margin:0;
    padding: 0;
    box-sizing: border-box;
    font-family: Arial, Helvetica, sans-serif;
    text-transform: capitalize;
    text-decoration: none;
}
body{
    background: #dee1e2;
    min-height: 100vh;
    overflow-x: hidden;
}
header{
    position: fixed;
    top:0;
    left:0;
    right:0;
    background: #fff;
    box-shadow: 0 5px 10px rgba(0,0,0,.1);
    padding: 20px 7%;
    display: flex;
    align-items:center;
    justify-content: space-between;
    z-index: 1000;
}
header .name{
    font-weight: bolder;
    font-size: 25px;
    color: #333
}
header .navbar ul{
    list-style: none;
}
header .navbar ul li{
    position: relative;
    float: left;
}
header .navbar ul li a{
    font-size: 20px;
    padding: 20px;
    color: #333;
    display: block;
}
header .navbar ul li a:hover{
    background: #333;
    color: #fff;
}
header .navbar ul li ul{
    position: absolute;
    left: 0;
    width: 200px;
    background: #fff;
}

#menu-bar{
    display: none;
}
header label{
    font-size: 20px;
    color: #333;
    cursor: pointer;
    display: none;
}
h1{
    color: #333;
}
@media(max-width:991px){
    header{
        padding: 20px;
    }

    header label{
        display: initial;
    }

    header .navbar{
        position: absolute;
        top:100%;
        left: 0;
        right: 0;
        background: #fff;
        border-top: 1 px solid rgba(0, 0, 0, .1);
    }

    header .navbar ul li{
        width: 100%;
    }

    header .navbar ul li ul{
        position: relative;
        width: 100%
    }

    #menu-bar:checked ~ .navbar{
        display: initial;
    }
}

I have attempted various methods like enclosing the navigation bar in a div and changing font colors without success. Any help on how to add additional code below the navigation bar would be highly appreciated. I have included the CSS and HTML code for reference and assistance. Your support will be greatly valued.

Answer №1

It is completely normal for your content to be hidden behind a fixed header. To work around this, you can add a margin-top value to the elements following your header enclosed in a <main> tag:

main {
  margin-top: 350px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: Arial, Helvetica, sans-serif;
  text-transform: capitalize;
  text-decoration: none;
}
body {
  background: #dee1e2;
  height: 100vh;
  overflow-x: hidden;
}
header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: #fff;
  box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 1000;
}
header .name {
  font-weight: bolder;
  font-size: 25px;
  color: #333;
}
header .navbar ul {
  list-style: none;
}
header .navbar ul li {
  position: relative;
  float: left;
}
header .navbar ul li a {
  font-size: 20px;
  padding: 20px;
  color: #333;
  display: block;
}
header .navbar ul li a:hover {
  background: #333;
  color: #fff;
}
header .navbar ul li ul {
  /*     position: absolute; */
  left: 0;
  width: 200px;
  background: #fff;
}

#menu-bar {
  display: none;
}
header label {
  font-size: 20px;
  color: #333;
  cursor: pointer;
  display: none;
}
h1 {
  color: #333;
}
@media (max-width: 991px) {
  main {
    margin-top: 80px;
  }
  header {
    padding: 20px;
  }

  header label {
    display: initial;
  }

  header .navbar {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border-top: 1 px solid rgba(0, 0, 0, 0.1);
  }

  header .navbar ul li {
    width: 100%;
  }

  header .navbar ul li ul {
    position: relative;
    width: 100%;
  }

  #menu-bar:checked ~ .navbar {
    display: initial;
  }
}
<header>
  <a href="https://ecj.com.jm/"> <img src="../img/ecjLogo.png" id="logo"> </a>
  <div class="name"> Business</div>

  <input type="checkbox" id="menu-bar">
  <label fr="menu-bar">Menu</label>

  <nav class="navbar">
    <ul>
      <li> <a href="#">Application</a></li>
      <li> <a href="#"> Help </a></li>
      <li> <a href="#"> About </a></li>
      <li> <a href="#"> Contact </a></li>
    </ul>
  </nav>

</header>

<main>
  <div>
    <h1>Geographic Information Systems (GIS) Department - ECJ Web Map Ver. 2.0 </h1>

    <p> hello </p>
  </div>
</main>

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

Tips on optimizing website performance by implementing lazy loading for images and ensuring they are ready for printing

Many websites feature an abundance of images, prompting the use of lazy loading to enhance load times and reduce data consumption. But what happens when printing functionality is also required for such a website? One approach could involve detecting the p ...

Adjusting the page width to ensure compatibility with all devices

I am facing difficulties with CSS regarding the properties width and margin. I am developing a webpage that should display properly on all devices, including PCs, smartphones, and tablets. I am using HTML <meta name="viewport" content="width=device-widt ...

Layering one canvas on top of another

Here is the code I am working with. With a JavaScript library, I can draw on the first canvas and then merge it onto the second canvas. My question is, how can I make the first canvas stay in place or float, regardless of where I scroll on the second canv ...

Mastering the Art of Customizing Styling in Ant Design

I'm currently working with a table from Ant Design, but I'm facing an issue where the padding or margin applied by the Ant Design CSS is preventing the table from expanding on the left side. The table has an inline CSS of table layout: auto which ...

React: Submit button not triggering form submission despite having a valid submit event handler and correct syntax

My question stands out from existing ones as it features valid syntax, correct use of type="submit" on the button, and a simple onSubmit handler on the form. Despite this, clicking the button fails to trigger the onSubmit handler. To illustrate ...

Ways to center Bootstrap panel in the middle of a webpage

Is there a way to center this entire panel on the web page? I could use some guidance with this. Does anyone have recommendations for a good book to learn Bootstrap design? <div class="panel panel-default" style="max-width:500px;margin-left:auto;margi ...

How can I use PHP to send the user to another PHP file?

After searching for answers with no luck, I ended up coming here to ask my question. Here is the code snippet in question : <a href="manage/10000' . $user["user_id"] . ' " class="user_grop">More Info</span></a> I am wondering ...

jQuery functions as expected in a test environment, but encounters issues when implemented on a live website

Recently, I implemented a piece of code that enables content to be copied from one div to another when a button is clicked: <a id="btn123">CLICK ME</a> <div id="test1"></div> <div id="test2"> <h1>Heading</h1> < ...

Angular: facing difficulty displaying static html pages on server, although they render correctly when run locally

Within my Angular project, I have stored a few static html files (specifically sampleText.html) in the src/assets/html folder. In one of my components, I am attempting to fetch and display this file. The following code is being used for this purpose. Every ...

Two flexible-sized containers placed side by side, with an ellipsis displayed on the left container

Can you achieve a layout where two elements are inside a container and float side-by-side? The right element should adjust its size based on the content while the left element fills the remaining space in the container with an ellipsis to truncate overflow ...

Automatically updating CSS file in progress

Is there a way to have CSS changes automatically update on my template without requiring me to manually refresh the page? I've noticed this question being asked multiple times, but none of the solutions provided seem to work for me. I attempted usin ...

Display an additional HTML page without altering the existing one

First of all, I would like to apologize for my poor English. Attending a French school didn't provide much opportunity to practice other languages. I have a header.html on my website that I am unable to modify because it is not owned by me. However, ...

Apply this class exclusively for mobile devices

Is there a way to add the class p-5 only for mobile devices? For desktop computers: <nav class="navbar navbar-expand-lg navbar-light bg-light" style="padding:0px 10px 0px 10px;"> For mobile devices: <nav class="navbar navbar-expand-lg navbar-l ...

How to maintain HTML list items in a single line while overlaying text

I'm seeking assistance with understanding how to solve a particular issue. I have multiple list elements with varying lengths of text content, each flanked by small images/icons on either side. Below is an example of the HTML structure: .truncate ...

Is the image clickable to slide back and forth?

How can I achieve a sliding effect when clicking on the bottom-coupon class? Currently, I am only able to implement show and hide functionalities without any sliding effects. The picture slowly hiding from right to left, with the coupon-layer sliding out f ...

I seem to be having trouble getting my style to work properly with Material UI's makeStyles

I am experiencing an issue with Material-UI makeStyles not working properly. I am trying to apply my CSS style but it doesn't seem to be taking effect. I suspect that Bootstrap or MaterialTable might be causing this problem. While Bootstrap4 works fin ...

Adjust jQuery UI's resize functionality to maintain the current total width

I arranged two containers horizontally using the position: absolute property. I am attempting to create a "resize bar" in the center that, when dragged, will expand one container while shrinking the other (thus maintaining the overall width). <div clas ...

Unable to modify text color after implementing mat-sort-header in Angular Datatable

My current setup involves using an Angular data table to display data. I recently added the mat-sort-header functionality, which allowed me to change the font color of the header text. Below is a breakdown of my code: <section id="main-content" ...

Solving Problems with Image Placement using CSS

As I embark on learning responsive CSS, the concept is still quite new to me. One issue I'm facing is the alignment of the images on the second row in comparison to the top images. I aim to have 4 images per row, with the flexibility for the image siz ...

Problems with aligning elements to both the left and right sides of the same line

Currently, I have two divs that I would like to float on the left and right sides. However, they seem to be sticking together and I can't seem to separate them.. HTML: <nav> <div id="nav_content"> <div id="home_ico ...