Home > Net >  Problem with Dropdown in bootstrap Navigation bar
Problem with Dropdown in bootstrap Navigation bar

Time:09-11

screenshotI want the dropdown menu not to overlap with other items in navigation bar. How to offset dropdown items below the navigation bar.

        <!DOCTYPE html>
    <html>
        <head>
            <title>Little Lemon Restaurant</title>
            <link rel="stylesheet" href="istyle.css">
            <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-iYQeCzEYFbKjA/T2uDLTpkwGzCiq6soy8tYaI1GyVh/UjpbCx/TYkiZhlZB6 fzT" crossorigin="anonymous">
            <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-u1OknCvxWvY5kfmNBILK2hRnQC3Pr17a RTT6rIHI7NnikvbZlHgTPOOmMi466C8" crossorigin="anonymous"></script>
        </head>
        <body>
            <nav >
                <div >
                    
                    <form  role="search">
                        <input  type="search" placeholder="Search">
                        <button  type="submit">Search</button>
                    </form>
                    <div >
                        <a  href="#" role="button" data-bs-toggle="dropdown">
                            Follow us
                        </a>
                        <ul >
                          <li><a  href="#">Facebook</a></li>
                          <li><a  href="#">Instagram</a></li>
                          <li><hr ></li>
                          <li><a  href="#">Something else here</a></li>
                        </ul>
                    </div>
                </div>
            </nav>
        </body>
    </html>

CodePudding user response:

Try adding mt-3 class to the ul tag:

<!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">
        <title>Little Lemon Restaurant</title>
        <link rel="stylesheet" href="istyle.css">
        <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-iYQeCzEYFbKjA/T2uDLTpkwGzCiq6soy8tYaI1GyVh/UjpbCx/TYkiZhlZB6 fzT" crossorigin="anonymous">
        <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-u1OknCvxWvY5kfmNBILK2hRnQC3Pr17a RTT6rIHI7NnikvbZlHgTPOOmMi466C8" crossorigin="anonymous"></script>    
</head>
<body>  
        <nav >
            <div >
                
                <form  role="search">
                    <input  type="search" placeholder="Search">
                    <button  type="submit">Search</button>
                </form>
                <div >
                    <a  href="#" role="button" data-bs-toggle="dropdown">
                        Follow us
                    </a>
                    <ul >
                      <li><a  href="#">Facebook</a></li>
                      <li><a  href="#">Instagram</a></li>
                      <li><hr ></li>
                      <li><a  href="#">Something else here</a></li>
                    </ul>
                </div>
            </div>
        </nav>
</body>
</html>

  • Related