Problems with the functionality of the hamburger menu

I've been trying to fix the hamburger menu on my personal website.

On mobile, all the menu options are displayed in a single row, rather than the classic stacked look of a hamburger menu.

Initially, the hamburger menu wasn't working at all. I found a fix online and added the "/*******HAMBURGER FIX*********/" code snippet, which made it work but not as intended.

html {
  height: 100%;
}

body {
  background-image: url('background.png');
  background-size: cover;
  background-position: center;
}

#content {
  text-align: center;
  text-shadow: 0px 4px 3px rgba(0, 0, 0, 0.4), 0px 8px 13px rgba(0, 0, 0, 0.1), 0px 18px 23px rgba(0, 0, 0, 0.1);
}
...
<!DOCTYPE html>
<html lang="en">

...and more HTML code

Answer №1

To ensure proper display on mobile devices, remember to include the following code:

<meta name="viewport" content="width=device-width, initial-scale=1.0">

Additionally, be sure to remove two unnecessary closing div tags located after the nav tag. Other than that, no other issues were identified.

CSS Styling:


html{
        height: 100%;
    }
body{

    background-image: url('background.png');
    background-size: cover;
    background-position: center;
}
#content{
    text-align: center;

    text-shadow: 0px 4px 3px rgba(0,0,0,0.4),
                 0px 8px 13px rgba(0,0,0,0.1),
                 0px 18px 23px rgba(0,0,0,0.1);
}
#const{
    color: #FFFFF5;
    font-weight: bold;
    font-size: 5em;
}
hr{
    width: 1000px;
    border-top: 1px solid #f8f8f8;
    border-bottom: 1px solid rgba(0,0,0,0.2)
}

.social i{
    padding-top: 100%;
    font-size: 3em;
    color: #cccccc;
}
.sections{
    padding-top:5%;
}
.sections .section-option i{
    padding-top: 15px;
    color:#999999;
    font-size: 13em;
}
.logo{
    font-size: 1.2em;
}

/*******HAMBURGER FIX*********/
@media (min-width: 991px) and (max-width: 768px) {
.navbar-collapse.collapse {
    display: none !important;
}
.navbar-collapse.collapse.in {
    display: block !important;
}
.navbar-header .collapse, .navbar-toggle {
    display: block !important;
}
.navbar-header {
    float:none;
}}

HTML Structure:


<nav class="navbar navbar-inverse">
    <div class="container">
      <div class="container-fluid">
        <!-- Brand and toggle get grouped for better mobile display -->
        <div class="navbar-header">
          <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
          <a class="navbar-brand" href="#"><i class="fa fa-code logo" aria-hidden="true"></i>    Halil Süheyb Becerek</a>
        </div>
        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
          <ul class="nav navbar-nav">
            <li class="active"><a href="#"><i class="fa fa-home" aria-hidden="true"></i>    Home</a></li>
            <li><a href="#"><i class="fa fa-pencil-square-o" aria-hidden="true"></i>    Blog</a></li>
            <li><a href="#"><i class="fa fa-github" aria-hidden="true"></i>    Projects</a></li>
            <li><a href="#"><i class="fa fa-briefcase" aria-hidden="true"></i>    Work /    <i class="fa fa-university" aria-hidden="true"></i> Education History</a></li>
          </ul>
... (continued structure)

For more details and reference, you can check the following link: Reference Link

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

Instructions for selecting a checkbox using boolean values

According to the HTML specification, you should use the checked attribute in the <input type="checkbox"> tag to indicate that it is checked. However, I only have a boolean value of either true or false. Unfortunately, I am unable to manipulate the b ...

Hover-activated dropdown menu

After reading numerous tutorials and spending hours trying to create a submenu on hover, I still can't seem to get it to work. My goal is to display "Zimmer", "Reservierung", and "Preise" in a vertical menu when hovering over "Hotel," and so on. Here ...

Python - Selenium: A guide to locating elements based on color

I have a situation where I need to select only the "Claim" button from the first div, even though both div cases are very similar. Is using background color a good way to identify my element? Or do you have any other ideas? 1. <div class="well well-sm ...

Enhance your website with a customizable language selection feature using HTML and CSS

Currently, I am in the process of creating a dynamic language selection feature using HTML and CSS. Initially, this is what it looks like: https://i.stack.imgur.com/bhnaA.png Upon hovering over it, this is the effect I want to achieve: https://i.stack.i ...

Change HTML to PDF with the ability to split text at page breaks

I recently attempted to convert an HTML/CSS document into a PDF file using the pdflayer.com API. Everything seemed to be working well, but I encountered a problem with line breaks splitting lines, as shown in this photo: https://i.sstatic.net/1tqKM.jpg I ...

When JSONP is used in cross-domain AJAX calls, it retrieves plain JSON data

I am facing an issue with an API that I need to integrate. The API provides JSON data, but as it involves a cross domain AJAX call, I have to utilize jsonp. $.ajax({ type: "GET", url: url + query, ...

Adapting Vue.js directive based on viewport size - a guide

Having an element with the v-rellax directive, I'm utilizing it for prallax scrolling in this particular div: <div id="image" v-rellax="{ speed: -5 }"></div> Currently, there's a need to adjust the speed property ...

Prevent redirection in JavaScript

My current script is designed to detect an Android device and then redirect the user to "android.html". Once on the "android.html" page, the user has the option to either download an app or click "CONTINUE" to proceed to "index.html". However, there seems ...

The data-ls attribute is currently not permitted on the svg element. Is there a way to fix this issue?

Upon running my site through the w3cvalidator tool, I encountered the following errors: "Attribute data-ls not allowed on svg element at this point" and "End tag svg did not match the name of the current open element (use)". Below is a snippet of the cod ...

Contrast the objects in views.py between two distinct model objects in Django

I am currently working on a feature that compares the skills required for different job postings (such as web development, marketing, etc) with the skills of a user who is logged in. If there is a match, the job posting will be displayed to the user. The ...

What is the method to obtain the dimensions of the browser window using JavaScript?

In my JavaScript code, I am trying to retrieve the browser window size and then set the size of a div element accordingly. I have two div elements that should adjust based on the window size. For example, if the window size is 568px, div1 should be 38% of ...

IE is giving an "Access is denied" message when making an Ajax request

I have implemented an AJAX request to check the response of websites like this: $.ajax ({ url: 'https://www.example.com', cache: false, success : function() { alert(new Date() - start) }, }) This code fun ...

Join together a pair of php variables

I am currently extracting text and color values from a form structured like this: Here are the codes in management.php: <form method="post" action=""> <input type="color" name="color"> <input type="text" name="text"> <input ...

Personalizing Web Push Alerts (Google Chrome)

I successfully implemented a web push notification for Google Chrome using Google Project and Service Worker. One thing I'm curious about is how to customize or style the push notification. The plain message box doesn't quite cut it for me – I ...

Guide to displaying the output of a JS calculation in a Bootstrap modal dialog box

I have a HTML and JavaScript code that determines the ideal surfboard for the user based on their input data (style, experience, height, weight) and displays the recommended surfboard type. Here is the initial code snippet I attempted to use: function c ...

Displaying incorrect results within the div container

I have been developing a website where a div element on a specific page displays values from a PHP file. Below is the PHP code responsible for rendering the information on the HTML: $output .= ' <div class="row text-left col-md-3 ...

Switching HTML text by clicking or tapping on it

I'm currently working on a website that will showcase lengthy paragraphs containing complicated internal references to other parts of the text. For instance, an excerpt from the original content may read: "...as discussed in paragraph (a) of section ...

Adjust the content of a table cell using jQuery

<td>09 Mars 2020</td> Using the string above, I have created a div. Here are the Jquery variables I am working with: date1 = 09 Mars 2020 date2 = 18 Mars 2020 My goal is to combine the content from another date with the existing date to ach ...

A null value is returned by an array

When I initiate an ajax request by clicking a button and passing the product ID to a controller, it then gets passed to a helper. In the helper, the product is added to the cart using the ID. Next, an array of data is created in this helper and returned to ...

Showing an error message without causing any displacement of elements positioned underneath

https://i.sstatic.net/2QvQb.jpg Is there a way to insert an error message text without displacing the element by 4 units using CSS or Javascript? ...