Creating a fully adaptable menu that adjusts seamlessly to varying screen sizes

I have come across many similar questions but have yet to find a solution to my specific issue. I am struggling to make this menu dropdown responsive with the page due to its absolute positioning. Using JS is an option for me as well. Any help or guidance would be greatly appreciated.

header{
nav{
    min-width: 280px;
    max-width: 479px;
    margin: 0 auto;
    clear: both;
    position: relative;
    .logo{
        padding: 13px 0 10px 9px;
        float: left;
    }//End of logo
    ul{
        list-style-type: none;
        border-bottom: 2px solid $white;
        margin-bottom: 6px;
        li{
            line-height: 23px;
            .nav-img{
                line-height: 50px;
                float: right;
                margin-right: 18px;
            }
            .nav-content{
                position: absolute;
                top: 60px;
                overflow: hidden;
                background-color: $dropdownColor;
                //margin: 0 auto;
                min-width: 280px;
                //width: 100%;
                max-width: 440px;
                padding: 0px 20px;
                max-height: 0px;
                .arrow{
                float: right;
                padding-top: 13px;
                }
                .nav-sub{
                    .second-menu{
                        li{
                            font-size: 12px;
                            display: inline-block;
                            line-height: 8px;
                        }
                        li+li:before {
                            padding: 2px;
                            color: $white;
                            content: "/\00a0";
                        }
                    }
                    a{
                        display: inline-block;
                        text-decoration: none;
                        color: $white;
                        font-weight: bold;
                    }
                    input{
                        width: 100%;
                        padding: 5px;
                        border: none;
                        background-image: url("../images/search_icon.png");
                        background-repeat: no-repeat;
                        background-position: center right 10px;
                        margin: 15px 0;
                    }  
                }
            }  
        }
        li:first-child{
            padding-top: 13px;
        }
        li:last-child{
            padding-bottom: 20px;
        }
    }//End of menu
}//End of nav
}//End of header
    <header>
        <nav>
            <div class="logo">
                <a href="#"><img src="./images/logo.png" alt="Error loading image!"></a>
            </div>
            <ul>
                <li>
                    <a href="#" class="nav-img"><img src="./images/menu_shape.png" alt="Error loading image!"></a>
                    <div class="nav-content">
                        <a class="arrow" href=""><img src="./images/dropdown_arrow.png" alt="Error loading image!"></a>                        <div class="nav-sub">
                            <ul>
                                <li><a href="#">About Us</a>
                                    <!--<ul>
                                        <li><a href="">Production</a></li>
                                        <li><a href="">Energy & Commodities</a></li>
                                        <li><a href="">Transport</a></li>
                                        <li><a href=""></a>Industrial Services</li>
                                    </ul>-->
                                </li>
                                <li><a href="#">Divisions</a></li>
                                <li><a href="#">Investors</a></li>
                                <li><a href="#">Corporate Responsibility</a></li>
                            </ul>
                            <ul class="second-menu">
                                <li><a href="">Home</a></li>
                                <li><a href="">Media Centre</a></li>
                                <li><a href="">Careers</a></li>
                                <li><a href="">Contact Us</a></li>
                            </ul>
                            <input type="search" placeholder="Search">
                        </div>
                    </div>
                </li>
            </ul>
        </nav>
    
</header>

Below are the images for reference:

https://i.sstatic.net/jr27W.png

https://i.sstatic.net/79HiA.png

The width can be defined in pixels, but responsiveness may be compromised. An alternative solution is needed.

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

Guide to creating a resource counter in node.js using mongodb, such as /post/1

Can someone provide guidance on how to incorporate a post counter in MongoDB? My initial thought is: Accept /post with data Retrieve the count from the mongo collection Add a custom id as {id: collection.count + 1} However, I'm uncertain about what ...

Using Grails to create remote functions with multiple parameters

Currently, I am able to send one parameter to the controller using the code snippet below in Javascript: <g:javascript> var sel = "test"; <g:remoteFunction action="newExisting" method="GET" update="updateThis" params="'sel='+s ...

Leveraging JQuery for Inserting Data Into mySQL Database

As I delve into JQuery for the first time while working on a project, I realize that this endeavor serves as more of a learning experience rather than a functional one. Currently, I have three PHP files in play: 'connection.php', which establishe ...

Variable not defined within loop, result may be affected

As a JavaScript beginner, I'm puzzled about why the first loop result shows an "undefined" variable while the rest include "bottles." The goal is to output a statement from 99 to 1. Below is a snippet of the code: /* * Programming Quiz: 99 Bottle ...

Observing the Transformation When Employing *ngIf or *ngSwitchCase in Angular 2

Can someone lend a hand? I've run into an issue where my custom JavaScript function is not working after using *ngIf or *ngSwitchCase to change the view. Any suggestions on how to resolve this would be greatly appreciated. ...

What causes the empty gap between the accordion title and its content in Bootstrap?

I'm currently working on a Bootstrap accordion and I've encountered a problem where a white line appears underneath the heading whenever I click to expand it. Here's the accordion Here's my current code snippet: HTML - All divs do clo ...

Splitting a string in Typescript based on regex group that identifies digits from the end

Looking to separate a string in a specific format - text = "a bunch of words 22 minutes ago some additional text". Only interested in the portion before the digits, like "a bunch of words". The string may contain 'minute', & ...

Avoiding redundant ajax requests from jquery datatable during server-side pagination

My jquery dataTable is currently set up to send a request to an MVC controller using ajax for data retrieval. While client side processing works fine, the response time is far too slow as it retrieves all records at once. To improve speed, I need to imple ...

Creating an HTML Excel file in ASP.NET

I am using a StringBuilder to dynamically generate a file. The file contains a table with two rows and two columns. In the second row, the first column has text and the second column contains another table. I have successfully created this design in HTML ...

Using Vue.js to set both v-model and v-bind:value on one input element

I have a React component that has a form for submitting user information. The main issue I'm facing is setting a default value in the input field. When the page loads, I want the input field to display the user's existing email address by defaul ...

Function starting too slow due to rapid Loading Spinner Image display

I am struggling with a function that is supposed to display the contents of posts when clicked on. My goal is to have a loading spinner appear for a few seconds before the post content shows up. However, I am facing an issue where the spinner only appears ...

The animation feature of the jQuery toggle method is not functioning as expected

In this HTML snippet, I have a JQUERY script that toggles elements with "red" and "green" classes. The code works but without any animation! I want to toggle them in a "slow" mode. I've tried using the animation method too, but it's not working. ...

What is the proper application of counter-reset when utilizing CSS counters to automatically number headings?

In my quest to automatically number headings with multiple levels of hierarchy in an HTML document using CSS, I have encountered various examples online that heavily rely on counter-reset. However, despite testing it in different configurations, I haven&ap ...

Is there a way for me to achieve a vertical page turning effect on a single page?

I am seeking to develop a unique calendar display consisting of 12 images that give the illusion of flipping up when clicked. While I am aware of turn.js, my knowledge of javascript is limited and I need guidance on how to proceed. Despite having a program ...

Encountering a problem while attempting to save a scss file in Visual Studio Code

As a beginner in using sass, I decided to utilize the node-sass NPM package for compiling scss files into CSS format. Upon saving the file, I encountered the following error: { "status": 3, "message": "Internal Error: File to ...

The Enigmatic Essence of TypeScript

I recently conducted a test using the TypeScript code below. When I ran console.log(this.userList);, the output remained the same both times. Is there something incorrect in my code? import { Component } from '@angular/core'; @Component({ sel ...

Getting the value of a hidden input field within a div by accessing the event.target that initiated the event in JavaScript

I am working with a set of li elements, each containing specific child elements structured like this: <li class="list"> <!--Parent--> <input type="hidden" id="id" value="3"> <!--Child 1--> <div class="cd-1">....</div ...

Add a library to a server with npm installation

When needing to incorporate a library like Croppie, the installation process involves using npm or Bower: npm install croppie bower install croppie Given that I am working on a server, I'm uncertain where to install it. Should it be on the server it ...

Can JSON be used to perform mathematical operations and calculations?

Utilizing the amazing json-server as my application's backend has been incredibly beneficial for custom data retrieval. However, it would be even more valuable if it supported calculations and expressions to mimic backend behavior. Consider this data ...

Any tips for setting up the justifiedGallery plugin to function with multiple galleries simultaneously?

Currently, I am utilizing a fantastic jquery plugin known as justified gallery. Below, you will find a simplified HTML syntax for implementing this plugin, followed by the corresponding JavaScript code. HTML <div id="my-gallery"> <a href="pa ...