Home > Back-end >  Why bottons didn't show/ HTML
Why bottons didn't show/ HTML

Time:03-22

Why my localhost:8080 didn't show the several buttons on the head in the page? The first picture is the website should be. And the second is mine. I attached my HTML code. Please help.

HTML


<!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" />

    <title>Navbar Template for Bootstrap</title>

    <!-- Bootstrap core CSS -->
    <link href="/css/bootstrap.min.css" rel="stylesheet" />

    <!-- Custom styles for this template -->
    <link href="/css/style.css" rel="stylesheet" />


</head>

<body>

<div >

    <!-- Static navbar -->
    <nav >
        <div >
            <div >
                <button type="button"  data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
                    <span >Toggle navigation</span>
                    <span ></span>
                    <span ></span>
                    <span ></span>
                </button>
                <a  href="#">Project name</a>
            </div>
            <div id="navbar" >
                <ul >
                    <li ><a href="#">Home</a></li>
                    <li><a href="#">About</a></li>
                    <li><a href="#">Contact</a></li>
                    <li >
                        <a href="#"  data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Dropdown <span ></span></a>
                        <ul >
                            <li><a href="#">Action</a></li>
                            <li><a href="#">Another action</a></li>
                            <li><a href="#">Something else here</a></li>
                            <li role="separator" ></li>
                            <li >Nav header</li>
                            <li><a href="#">Separated link</a></li>
                            <li><a href="#">One more separated link</a></li>
                        </ul>
                    </li>
                </ul>
                <ul >
                    <li ><a href="./">Default <span >(current)</span></a></li>
                    <li><a href="../navbar-static-top/">Static top</a></li>
                    <li><a href="../navbar-fixed-top/">Fixed top</a></li>
                </ul>
            </div><!--/.nav-collapse -->
        </div><!--/.container-fluid -->
    </nav>

    <!-- Main component for a primary marketing message or call to action -->
    <div >
        <h1>Navbar !!!example</h1>
        <p>This example is a quick exercise to illustrate how the default, static navbar and fixed to top navbar work. It includes the responsive CSS and HTML, so it also adapts to your viewport and device.</p>
        <p>
            <a  href="../../components/#navbar" role="button">View navbar docs &raquo;</a>
        </p>
    </div>

</div> <!-- /container -->


<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://code.jquery.com/jquery-1.12.4.min.js" integrity="sha384-nvAa0 6Qg9clwYCGGPpDQLVpLNn0fRaROjHqs13t4Ggj3Ez50XnGQqc/r8MhnRDZ" crossorigin="anonymous"></script>

<script src="/js/bootstrap.min.js"></script>

</body>
</html>

enter image description here This is picture is what I need to create.

enter image description here The second picture is what I was created.

CodePudding user response:

it's not working because this template is based on bootstrap 3 and you seem to be using bootstrap 5 css file. so either

  • replace <link href="/css/bootstrap.min.css" rel="stylesheet" /> with <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" >.
  • or check https://getbootstrap.com/ and learn the new bootstrap 5 feature (I recommend you to do so)

CodePudding user response:

you can use it like that and add your style to body content:

<!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" />

    <title>Navbar Template for Bootstrap</title>

    <!-- Bootstrap core CSS -->
    <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
    <!-- Custom styles for this template -->


</head>

<body>

<div >
    <nav >
        <div >
          <a  href="#">Navbar</a>
          <button  type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
            <span ></span>
          </button>
          <div  id="navbarSupportedContent">
            <ul >
              <li >
                <a  aria-current="page" href="#">Home</a>
              </li>
              <li >
                <a  href="#">about</a>
              </li>
              <li >
                <a  href="#">contact</a>
              </li>
              <li >
                <a  href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
                  Dropdown
                </a>
                <ul  aria-labelledby="navbarDropdown">
                  <li><a  href="#">Action</a></li>
                  <li><a  href="#">Another action</a></li>
                  <li><hr ></li>
                  <li><a  href="#">Something else here</a></li>
                </ul>
              </li>
            </ul>
            <ul >
                <li >
                    <a >default</a>
                  </li>
                  <li >
                    <a >static</a>
                  </li>
                  <li >
                    <a >static</a>
                  </li>
             
            </ul>
           
          </div>
        </div>
      </nav>
    <!-- Main component for a primary marketing message or call to action -->
    <div >
        <h1>Navbar !!!example</h1>
        <p>This example is a quick exercise to illustrate how the default, static navbar and fixed to top navbar work. It includes the responsive CSS and HTML, so it also adapts to your viewport and device.</p>
        <p>
            <a  href="../../components/#navbar" role="button">View navbar docs &raquo;</a>
        </p>
    </div>

</div> <!-- /container -->


<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://code.jquery.com/jquery-1.12.4.min.js" integrity="sha384-nvAa0 6Qg9clwYCGGPpDQLVpLNn0fRaROjHqs13t4Ggj3Ez50XnGQqc/r8MhnRDZ" crossorigin="anonymous"></script>

<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg OMhuP IlRH9sENBO0LRn5q 8nbTov4 1p" crossorigin="anonymous"></script>
</body>
</html>

here

  • Related