Welcome to Code Forum!

Join a community that supports you and your coding journey from day one. We strive to be a friendly, supportive community that empowers everyone to be better developers. By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.

    GIF shows where to locate </> in the thread and or post editor toolbar.
    To learn more about how to use our BBCode feature, review our "How to post your code into threads" here.

    Thank you, Code Forum.

NAVBAR Help

RHH

Coder
I've created an HTML and CSS file pair that displays a navbar that I want to use on my website. The pair works and displays the navbar just as I want it to.

When I try to cut and paste the HTML into my index.html file and the CSS into my CSS file, it breaks the display. Obviously there is something I don't know.

I've searched and read articles and gone to my old books to no avail. I'm posting my code that works for the heading alone.

In the CSS you can see that I tried to use a gridbox but abandoned it in favor of the ul approach which works.

My questions are 1) can this code be cut and pasted into the relevant files? 2) If so, how? 3) Should I be using a different approach? 4) If so, what?

TIA


Code:
/*  filename:  clan.css */


/* design and create a header - maybe just a line of menu items */


/* #navbar */

#navbar {position:relative; z-index:  9999;}          /* Navbar is on top */

#idOfContentHere {position: relative; z-index:0}  /* Your content is not on top */



.navbar

{

  display: grid;

  position: relative;

  z-index: 9999;

  margin-left: auto;

  margin-right: auto;

  width: 1100px;

  height: 20px;

  border-width: 2px;

  border-style: ridge;

  border-radius: 5px;

  grid-template-columns: ;

  grid-template-rows: 1;

  grid-template-areas:

    'home personal-pages hutchins-line baker-line histories anecdotes submissions search help';

}


.navbar > div

{

  background-color: beige;

  text-align: center;

  font-size: 15px;

  padding: 5px;

}


.home

{

  grid-area: home;

}


.personal-pages

{

  grid-area: personal-pages;

}


.hutchins-line

{

  grid-area: hutchins-line;

}


.baker-line

{

  grid-area: baker-line;

}


.histories

{

  grid-area: histories;

}


.anecdotes

{

  grid-area: anecdotes

}


.submissions

{

  grid-area: submissions;

}


.search

{

  grid-area: search;

}


.help

{

  grid-area: help;

}


/*    End of NAVBAR    */


HTML
<!DOCTYPE html>
<html lang="en-US">
<head>
<title>
The Hutchins Clan
</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link type="text/css"
rel="stylesheet" href="CSS/clan.css" media="screen">
<!-- 26 SEP 2023 -->
</head>
<body>
 
Back
Top Bottom