What is the process for incorporating icons and choices into the header bar?

Seeking advice on how to incorporate an icon into the right side alignment of a simple blank header on my webpage, similar to the image provided. I have searched through numerous threads on StackOverflow without finding a suitable solution. Could someone share a straightforward SCRIPT that would enable me to achieve this in a responsive manner? Thank you in advance!

#header_container {
    background: #232F3E ;
    color:#fff;
    border:1px solid #232F3E;
    height:auto;
    left:0;
    position:fixed;
    width:100%;
    top:0;
}

#header {
    height:42px;
    line-height:42px;
    margin:0 auto;
    width:auto;
    font-weight:bold;
    text-align:left;
}

Click here for the Header Icon Image

Answer №1

Is this the type of design you have in mind?

This tutorial demonstrates how to create a right-aligned navigation bar using Font Awesome icons and flexbox.

For Font Awesome icons, visit: https://fontawesome.com/icons?from=io

Learn about flexbox here: https://css-tricks.com/snippets/css/a-guide-to-flexbox/

$('#navButton').click(function() {
  $('.subNav').slideToggle('slow', function() {});
});
.navigation {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  list-style-type: none;
  display: -webkit-box;
  display: -moz-box;
  display: -ms-flexbox;
  display: -webkit-flex;
  display: flex;
  justify-content: flex-end;
  background-color: #5d80ba;
  height: 40px;
  z-index: 50;
}

.navigation li {
  display: inline-flex;
  flex-direction: row;
}

.navigation li a {
  padding: 10px;
  cursor: pointer;
  justify-content: space-between;
}

.navigation li a:hover {
  color: #dddddd;
  background-color: #334ba1;
}

.subNav {
  display: none;
  position: fixed;
  top: 40px;
  right: 0;
  width: 100px;
  background-color: #8f80ba;
  z-index: 40;
  list-style-type: none;
}

.subNav li {
  display: inline-block;
  width: 45px;
  padding-top: 10px;
  padding-bottom: 10px;

}

.subNav li:hover {
  cursor: pointer;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link href="https://use.fontawesome.com/releases/v5.0.6/css/all.css" rel="stylesheet>

<ul class="navigation">
  <li>
    <a><i class="fas fa-bed"></i></a>
  </li>
  <li>
    <a><i class="fas fa-beer"></i></a>
  </li>
  <li>
    <a><i class="fas fa-utensils"></i></a>
  </li>
  <li>
    <a><i class="fas fa-utensils"></i></a>
  </li>
  <li>
    <a><i class="fas fa-bed"></i></a>
  </li>
  <li>
    <a><i class="fas fa-beer"></i></a>
  </li>
  <li>
    <a><i class="fas fa-utensils"></i></a>
  </li>
  <li>
    <a id="navButton"><i class="fas fa-bars"></i></a>
  </li>

</ul>

<ul class="subNav">
  <li>
    <a><i class="fas fa-bed"></i></a>
  </li>
  <li>
    <a><i class="fas fa-utensils"></i></a>
  </li>
  <li>
    <a><i class="fas fa-beer"></i></a>
  </li>
  <li>
    <a><i class="fas fa-utensils"></i></a>
  </li>
  <li>
    <a><i class="fas fa-beer"></i></a>
  </li>
  <li>
    <a><i class="fas fa-utensils"></i></a>
  </li>
</ul>

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

Error: The function initMap() is not recognized in the Google Maps API

I have been experimenting with the Flickr API and I'm currently working on asynchronously loading images along with their metadata. To accomplish this, I have a script that utilizes three AJAX calls: $(document).ready(function() { var latLon = { ...

What is the CSS code to apply a color to a white area on a

How do I add color to the white space between the blue blocks? Here is the code snippet: #nav{ padding:0; } .rech{ margin-left: 785px; } .px{ margin-left: 3px; } #nav li{ display:inline; } #nav li a, .rech{ font-family:Arial; font- ...

Top approach for creating/previewing a website using PHP, CSS, and MYSQL

When creating a website that will eventually be hosted on a remote server, what is the most effective way to code and test? Here are some examples of what I mean: - Develop locally on your computer and access files from there. Should libraries and databa ...

Extract the element when the mouse is clicked

I'm currently working on developing a Chrome extension with a specific goal in mind: My aim is to capture the username when a user Ctrl-clicks on a username while browsing Reddit, and then transfer that username from the content script page to the ba ...

Replacing the yellow autofill background

After much effort, I have finally discovered the ultimate method to remove autofill styling across all browsers: $('input').each(function() { var $this = $(this); $this.after($this.clone()).remove(); }); However, executing t ...

The button must be programmed to remove a specific item from the server

I am currently developing an application to monitor my expenses using javascript, nodejs, express, and handlebars as the templating engine. Within the app, I have a "list" div that displays all of my expenses. (There is an add button next to the list, not ...

Align three divs vertically within one div, all floated to achieve the desired layout

Can someone help me align three divs vertically within a container div? The challenge is that all three divs inside the container are floated - one on the right, one in the center, and one on the left to create a navbar. I've seen the navbars in Boot ...

Tips for setting up a hierarchical mat-table within a parent table that supports expandable rows using Angular Material

Here is the data that I am working with: [ { "_id": "c9d5ab1a", "subdomain": "wing", "domain": "aircraft", "part_id": "c9d5ab1a", "info.mimetype": "application/json", "info.dependent": "parent", ...

Discover the secret sauce to effortlessly adding text upon hovering over a button

I am completely new to CSS and only know the basics. Recently, I stumbled upon this code online that creates a button. However, I want to use an image inside the button, add a color overlay when hovered, and display text saying "LEARN MORE" upon hovering ...

The JQuery library in Mygento seems to be malfunctioning and not working

I am looking to implement Jquery UI on my Magento website and have installed Mygento JQuery, which includes the jQuery UI module. However, I am encountering an error stating jQuery is not defined. Can someone guide me on how to properly utilize the Mygent ...

Convert the array to a JSON format

My goal is to design a form based on a JSON file to store settings. This will make it appear database-driven, while actually being file-driven, which can help set up the database and other configurations easily. I am almost there but struggling with submit ...

Sending JSON data to PHP using AJAX request

Currently attempting to send textbox values to a database via JSON and .getJSON. I am currently testing whether the JSON is successfully posting to the page, as I have confirmed that the UPDATE query is functioning correctly... The following code is not a ...

My JavaScript code is functioning properly in jsfiddle, but when I try to run it on my own website, I encounter

Encountered an error message stating "Uncaught typeError: cannot call method 'hover' of null" following the line $('#nav li a').hover(function(){ in my JavaScript code. Check out the code on my site here: http://pastebin.com/GjZBEu3s Y ...

Import the complete JSON file into a variable as an array

I am struggling with loading an external json file (locations.json) into a variable and then using the information found here: http://www.json.org/js.html Despite trying various methods, I have not been successful in populating the variable. Even after fo ...

A guide to storing data within the client's HTML: Tips and tricks for optimal storage placement

As I develop my website, I am using a technique where I store a simplified version of the web page within the HTML itself. This allows me to send efficient Ajax requests back to the server, as it can analyze what the client's page looks like and send ...

Navigation structure on a website built with HTML

As I dive into HTML5 programming, I am working on creating a simple navigation menu with links to different HTML pages such as "1.html", "2.html," and others. However, when I click on a link like "1.html," it takes me to a new page where the navigation men ...

The peculiar characteristics of the dragLeave event in various web browsers

I observed a peculiar behavior while working with drag events in Internet Explorer 11. It seems that adding a 'width' property to the elements triggers the dragLeave event, whereas without it, the event does not fire. Can anyone shed light on why ...

Rails 4 experiences a strange phenomenon where Ajax is triggered twice, resulting in the replacement of

After reviewing other similar questions, it appears that the best approach is to wait for the initial Ajax request to complete before proceeding with the next one. I believed that the following code would handle this situation, but somehow the request is t ...

Unique underlined text design (+using+ and - symbols-)

I'm looking to create a customized text decoration, as shown in the image below: https://i.stack.imgur.com/emjND.png It's easy to achieve a dashed line using CSS for decorations like this: color: red; border-bottom: 3px dashed; // You can adjus ...

Can adjusting the viewport by using touch controls alter the size of the viewing screen?

When I tried to zoom in on a webpage using touch instead of the keyboard shortcut Ctrl +, I noticed that the elements stayed the same size but the screen itself was enlarged. It seems like this method does not affect the size of the viewport. However, whe ...