Home > Software engineering >  Bootstrap .container not working in a simple code
Bootstrap .container not working in a simple code

Time:11-07

Here's the code :

<!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 href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
    <link rel="stylesheet" href="style.css" />
    
    <title>Home</title>
</head>
<body>
    
    <nav class="navbar navbar-expand-lg bg-dark navbar-dark">
        <div class="cantainer">
            
             <a href="#" class="navbar-brand">Home</a>

        </div>    
    </nav>

        
    <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP JcXn/tWtIaxVXM" crossorigin="anonymous"></script>

</body>
</html>

As you can see in the image i uploaded, The Home button that is a "navbar-brand", is not getting some distance and it is right up against the edge. what is the solution you think?

The Image

CodePudding user response:

You have mistaken the class name ( cantainer ). It will be container

container

 <div class="container">
    <a href="#" class="navbar-brand">Home</a>
</div>   

CodePudding user response:

it should be container , not cantainer

  <nav class="navbar navbar-expand-lg bg-dark navbar-dark">
    <div class="container">
        
         <a href="#" class="navbar-brand">Home</a>

    </div>    
</nav>
  • Related