Is there a way to evenly space out the buttons in the Nav element with more room in between each one?

I need the buttons to be evenly spaced with more room between them. And, of course, they need to be responsive in the end. I attempted to use Bootstrap's "d-flex" class to arrange the buttons, but it didn't work as expected.

If you review my Bootstrap columns and have any suggestions on how to make the code more efficient, feel free to offer improvements in that area as well.

Here is the code:

function menuButton(button) {

    var productElement = button.classList;

    if (productElement !== null) {
        if (productElement.contains("Start-Button")) {
            window.location.href = "index.html";
            console.log("redirected to 'index.html'");
        } else if (productElement.contains("Shop-Button")) {
            window.location.href = "products.html";
            console.log("redirected to 'products.html'");
        } else if (productElement.contains("Kontakt-Button")) {
            window.location.href = "contact.html";
            console.log("redirected to 'contact.html'");
        } else {
            console.error("menuButton: ERROR / No CSS-Class found!")
        }
    }
}
body {
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.wrapper-1 {

    position: relative;
    overflow: hidden;
}

#background-video {
    height: 30vh;
    width: 100%;
    position: absolute;
    object-fit:cover;
}

.head-sentence {
    color: yellow;
    text-align: center;
    margin-top: 4vh;
    font-family: "Black Ops One";
    font-size: 6vh;
    padding: 10px;
    border: 5px;
    border-style: solid;
    border-radius: 10px;
    border-color: yellow;
    backdrop-filter: blur(5px);
}

.Start-Button, .Shop-Button, .Kontakt-Button {
    color: yellow;
    background-color: rgba(0, 0, 0, 0);
    font-family: "Black Ops One";
    text-decoration: underline;
    backdrop-filter: blur(5px);
    border-radius: 5px;
}
<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="bfddd0d0cbcccbcddecfff8a918c918d">[email protected]</a>/dist/css/bootstrap.min.css" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
        <link rel="stylesheet" type="text/css" href="styles.css">
        <script src="scripts.js"></script>
        <title>Dädalus</title>
        <link rel="preconnect" href="https://fonts.googleapis.com">
        <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
        <link href="https://fonts.googleapis.com/css2?family=Black+Ops+One&display=swap" rel="stylesheet">
        <link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Caveat" rel="stylesheet">
        <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="c8aaa7a7bcbbbcbaa9b8e5a1aba7a6bb88f9e6f1e6f9">[email protected]</a>/font/bootstrap-icons.css">
    </head>
    <body>
        <video id="background-video" src="img/video (2160p).mp4" autoplay muted loop></video>
        <div class="container-fluid wrapper-1">
            <div class="row">
                <div class="col-md-3"></div>
                <div class="col-md-6 d-flex flex-column align-items-center justify-content-center">
                    <h2 class="head-sentence">Dädalus</h2>
                </div>
                <div class="col-md-3"></div>
            </div>
            <div class="row nav-bar">
                <div class="col-md-3 col-sm-1">
                </div>
                <div class="col-md-6 col-sm-10 d-flex align-items-center justify-content-center nav-width">
                    <nav style="margin-top: 20px;">
                        <button class="Start-Button" onclick="menuButton(this)">Start</button>
                        <button class="Shop-Button" onclick="menuButton(this)">Products</button>
                        <button class="Kontakt-Button" onclick="menuButton(this)">Contact</button>
                    </nav>
                </div>
                <div class="col-md-3 col-sm-1">
                    
                </div>
            </div>
            <div class="row">
                <div class="col-md-1"></div>
                <div class="col-md-10"></div>
                <div class="col-md-1"></div>
            </div>
            
        </div>
    </body>
</html>

Answer №1

Modified some classes within the nav section, specifically:

class="w-100 mt-3 d-flex justify-content-evenly"

function menuButton(button) {

    var productElement = button.classList;

    if (productElement !== null) {
        if (productElement.contains("Start-Button")) {
            window.location.href = "index.html";
            console.log("redirected to 'index.html'");
        } else if (productElement.contains("Shop-Button")) {
            window.location.href = "products.html";
            console.log("redirected to 'products.html'");
        } else if (productElement.contains("Kontakt-Button")) {
            window.location.href = "contact.html";
            console.log("redirected to 'contact.html'");
        } else {
            console.error("menuButton: ERROR / No CSS-Class found!")
        }
    }
}
body {
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.wrapper-1 {

    position: relative;
    overflow: hidden;
}

#background-video {
    height: 30vh;
    width: 100%;
    position: absolute;
    object-fit:cover;
}

.head-sentence {
    color: yellow;
    text-align: center;
    margin-top: 4vh;
    font-family: "Black Ops One";
    font-size: 6vh;
    padding: 10px;
    border: 5px;
    border-style: solid;
    border-radius: 10px;
    border-color: yellow;
    backdrop-filter: blur(5px);
}

.Start-Button, .Shop-Button, .Kontakt-Button {
    color: yellow;
    background-color: rgba(0, 0, 0, 0);
    font-family: "Black Ops One";
    text-decoration: underline;
    backdrop-filter: blur(5px);
    border-radius: 5px;
}
<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap/dist/css/bootstrap.min.css" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
        <link rel="stylesheet" type="text/css" href="styles.css">
        <script src="scripts.js"></script>
        <title>Dädalus</title>
        <link rel="preconnect" href="https://fonts.googleapis.com">
        <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
        <link href="https://fonts.googleapis.com/css2?family=Black+Ops+One&display=swap" rel="stylesheet">
        <link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Caveat" rel="stylesheet">
        <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/font/bootstrap-icons.css">
    </head>
    <body>
        <video id="background-video" src="img/video (2160p).mp4" autoplay muted loop></video>
        <div class="container-fluid wrapper-1">
            <div class="row">
                <div class="col-md-3"></div>
                <div class="col-md-6 d-flex flex-column align-items-center justify-content-center">
                    <h2 class="head-sentence">Dädalus</h2>
                </div>
                <div class="col-md-3"></div> 
            </div>
            <div class="row nav-bar">
                <div class="col-md-3 col-sm-1">
                </div>
                <div class="col-md-6 col-sm-10 d-flex align-items-center justify-content-center nav-width">
                    <nav class="w-100 mt-3 d-flex justify-content-evenly">
                        <button class="Start-Button" onclick="menuButton(this)">Start</button>
                        <button class="Shop-Button" onclick="menuButton(this)">Produkte</button>
                        <button class="Kontakt-Button" onclick="menuButton(this)">Kontakt</button>
                    </nav>
                </div>
                <div class="col-md-3 col-sm-1">
                    
                </div>
            </div>
            <div class="row">
                <div class="col-md-1"></div>
                <div class="col-md-10"></div>
                <div class="col-md-1"></div>
            </div>
            
        </div>
    </body>
</html>

Answer №2

            function menuButton(button) {

var productElement = button.classList;

if (productElement !== null) {
    if (productElement.contains("Start-Button")) {
        window.location.href = "index.html";
        console.log("redirected to 'index.html'");
    } else if (productElement.contains("Shop-Button")) {
        window.location.href = "products.html";
        console.log("redirected to 'products.html'");
    } else if (productElement.contains("Kontakt-Button")) {
        window.location.href = "contact.html";
        console.log("redirected to 'contact.html'");
    } else {
        console.error("menuButton: ERROR / No CSS-Class found!")
    }
}
}
    body {
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    
}

.wrapper-1 {

    position: relative;
    overflow: hidden;
}

#background-video {
    height: 30vh;
    width: 100%;
    position: absolute;
    object-fit:cover;
}

.head-sentence {
    color: yellow;
    text-align: center;
    margin-top: 4vh;
    font-family: "Black Ops One";
    font-size: 6vh;
    padding: 10px;
    border: 5px;
    border-style: solid;
    border-radius: 10px;
    border-color: yellow;
    backdrop-filter: blur(5px);
}

.Start-Button, .Shop-Button, .Kontakt-Button {
    color: yellow;
    background-color: rgba(0, 0, 0, 0);
    font-family: "Black Ops One";
    text-decoration: underline;
    backdrop-filter: blur(5px);
    border-radius: 5px;
}
<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="8defe2e2f9fef9ffecfdcdb8a3bea3bf">[email protected]</a>/dist/css/bootstrap.min.css" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
        <link rel="stylesheet" type="text/css" href="styles.css">
        <script src="scripts.js"></script>
        <title>Dädalus</title>
        <link rel="preconnect" href="https://fonts.googleapis.com">
        <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
        <link href="https://fonts.googleapis.com/css2?family=Black+Ops+One&display=swap" rel="stylesheet">
        <link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Caveat" rel="stylesheet">
        
        <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="fc9e9393888f888e9d8cd1959f93928fbccdd2c5d2cd">[email protected]</a>/font/bootstrap-icons.css">

    </head>
    <body>
        <video id="background-video" src="img/video (2160p).mp4" autoplay muted loop></video>
        <div class="container-fluid wrapper-1">
            <div class="row">
                <div class="col-md-3"></div>
                <div class="col-md-6 d-flex flex-column align-items-center justify-content-center">
                    <h2 class="head-sentence">Dädalus</h2>
                </div>
                <div class="col-md-3"></div> 
            </div>
            <div class="row nav-bar">
                <div class="col-md-3 col-sm-1">
                </div>
                <div class="col-md-6 col-sm-10 d-flex justify-content-evenly nav-width">  
                    <!-- here i remove the nav tag and "justify-content-evenly" bootstrap property -->
                        <button class="Start-Button" onclick="menuButton(this)">Start</button>
                        <button class="Shop-Button" onclick="menuButton(this)">Produkte</button>
                        <button class="Kontakt-Button" onclick="menuButton(this)">Kontakt</button>
                    
                </div>
                <div class="col-md-3 col-sm-1">
                    
                </div>
            </div>
            <div class="row">
                <div class="col-md-1"></div>
                <div class="col-md-10"></div>
                <div class="col-md-1"></div>
            </div>
            
        </div>

    </body>
</html>

Here is the response to your inquiry... The issue has been resolved!

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

Can I exclusively utilize named exports in a NextJS project?

Heads up: This is not a repeat of the issue raised on The default export is not a React Component in page: "/" NextJS I'm specifically seeking help with named exports! I am aware that I could switch to using default exports. In my NextJS ap ...

Is there a way to adjust the width and create the illusion that the div is sliding in from off screen?

I successfully animated a side navigation menu to slide in from the left of the screen. The animation is working perfectly, however, I had to set the div's width to 0px in order for it to appear as though it's sliding in from off-screen. If I ch ...

Retrieving specific value from a Parent Controller in AngularJS using UI Router

I have a request to display the value stored in $scope.resAVal on my index.html page. This value is accessible within the RootCtrl. index.html <!DOCTYPE html> <html ng-app="plunker"> <head> <!-- any required JavaScript librarie ...

Connecting two tables in an express API

Currently, I am in the process of developing an API using Express.js. At this stage, my initial tests are functioning correctly. My goal now is to retrieve values from two separate tables. For example, consider the following 2 tables: Table_A Id: 1, Name: ...

The decision will be dependent on the outcomes provided by the $resource promise

I have been working on calling my API with AngularJS to retrieve a list of 'reports' and then displaying them in a modal or saving the sale depending on whether any results were returned. I've been struggling with this for a while and would ...

Accelerate blinking timer by utilizing CSS3 animations

I'm currently developing a quiz application that includes a timer counting down from 10 seconds to 0 seconds. As the timer reaches closer to 0 seconds, I am looking to implement a feature where my text blinks faster and faster. Additionally, I would l ...

Customize div styles according to the website domain

I want to dynamically change the header of my website based on whether it is in dev QA or production environment. Below is the HTML code: <div id="wrapper"> <form id="form1" runat="server"> <div class="wrapper"> <div> ...

Implement a click event using jQuery specifically for Internet Explorer version 7

How can I add an onclick attribute using jQuery that is compatible with IE7? So far, the following code works in browsers other than IE8 and Mozilla: idLink = Removelst(); var newClick = new Function(idLink); $(test1).attr('onclick', null).clic ...

The data sent within an event does not trigger reactivity

Not producing errors, just failing to function. The addition of this also has no impact. input( type="number" v-model="myData" @wheel="wheelIt($event, myData, myMethod)" ) ... methods: { wheelIt ( event, data, func ) { if ( event.deltaY ...

Step-by-step guide to generating a Paypal Button using Vue 3 script setup

After going through the PayPal Developer Docs, I'm still struggling to understand how to integrate the PayPal Button into Vue.js. The code examples provided are unclear, and I can't determine if it's related to Vue 2, Vue 3, or even Angular. ...

Obtain the selected dropdown value and transfer it to the controller seamlessly without the need to reload the page

Currently, I am facing an issue with two dropdown lists in a bootstrap modal - CATEGORY and SUBCATEGORY. The values in the SUBCATEGORY list depend on the selection made in the CATEGORY list. My goal is to retrieve the selected value ID and pass it to my co ...

Which is better: Starting with rows or columns in Bootstrap 4 layout design?

Many Bootstrap 4 grid layout demos feature columns within rows, but is it considered improper to have rows within columns? For example: <div class="col col-md-6"> <div class="row"> </div> </div> ...

Arranging Form Elements with Bootstrap styling

Check out the Bootply I created to demonstrate an issue I'm facing: http://www.bootply.com/8fPmr31Wd7 When scrolling down, you'll notice that "People" and "Places" are indented on the sides. It's possible that I'm not using the correc ...

What are effective ways to eliminate cross-origin request restrictions in Chrome?

Just starting out with angular and trying to incorporate a templateUrl in an angular directive. However, when attempting to view the local html file in the browser, I encounter the following errors --> XMLHttpRequest cannot load file:///Users/suparnade ...

Tips for applying various CSS properties to a single element using styled-components

Is there a way to style similar elements differently using different CSS properties in styled components? For example: <div></div> <div></div> With the knowledge I have, I can do: export const StyledDiv = styled.div` color: red; ` ...

Exploring the tab-content features of Bootsrap 5 through anchor tags

In the previous version of Bootstrap, the tab-pane used to fade in active. However, in the new version, it is now: tab-pane fade show active. What other improvements can I make? <!DOCTYPE html> <html lang="en"> <head> <m ...

Choose class based on the retrieved information

Good morning, I am working on dynamically setting the class of a td element based on data fetched from a database to reflect any changes or updates. One of the fields returned has four possible options, and I need to modify the CSS class of that field acc ...

What are the steps to transform a blob into an xlsx or csv file?

An interesting feature of the application is the ability to download files in various formats such as xlsx, csv, and dat. To implement this, I have utilized a library called fileSaver.js. While everything works smoothly for the dat/csv format, there seems ...

Issue with hiding div using jQuery's length option

I'm currently using Drupal 7.0 along with the Galleria Javascript Image Gallery in fullscreen theme. My theme includes two navigation buttons, and here is the CSS code for them: .galleria-image-nav { height: 159px; opacity: 0.8; position: fixed ...

Utilizing an NPM package in your project

Trying to incorporate a node module called "tagify" into my node.js application has been challenging. Following the instructions in the package's readme file (https://www.npmjs.com/package/@yaireo/tagify#installation), I executed the setup steps as ou ...