Implementing a hamburger menu and social media sharing buttons on websites

Currently working on my personal website and delving into the world of Web Development, I have some inquiries for seasoned developers.

My first query revolves around incorporating a hamburger menu onto my site for easy navigation to other pages. After attempting to add various code snippets to my main HTML and CSS files without success, I am wondering if it would be best to create separate HTML/CSS/JS files specifically for the menu and then link them to the main files. Any insights or solutions would be greatly appreciated.

Here are a few examples that I've come across:

https://codepen.io/brenden/pen/VLjKMQ/
,
https://codepen.io/netfuel/pen/rIlnB/
,
https://codepen.io/sergioandrade/pen/onkub
.

Secondly, I have encountered an issue with the share buttons on my website implemented through AddToAny. While the Twitter and WhatsApp buttons function smoothly, the Facebook button seems problematic (as seen in the 1st screenshot). The href code utilized is

href="https://www.addtoany.com/share"
. Could this problem be related to the fact that my website is not yet live?

In addition, I am aiming to make the buttons on my site smaller and more responsive (visible in the 2nd screenshot). Attempts using

style="font-size: .. ;"
have thus far proven unsuccessful.

Thank you for any assistance offered.

https://i.stack.imgur.com/iXcaF.jpg https://i.stack.imgur.com/rZWNP.jpg

Edit: https://i.stack.imgur.com/Fv3uk.jpg

Answer №1

You have the option to consolidate all of your CSS styling within a single CSS file, eliminating the need to create multiple files.

Furthermore, it is not necessary for your website to be live in order to establish external links, such as linking to your Facebook page.

If you are experiencing difficulties, please share your code so that I can better assist you. There may be conflicting styles, such as those from the <body> tag, impacting your menu. When adjusting button sizes, consider using simple width and height properties. Sharing your code on jsfiddle.net can facilitate collaboration and troubleshooting efforts.

Note: Avoid inline styles in HTML and instead utilize your CSS file for cleaner and more manageable code in the long term.

To enlarge icons, adjust the height and width attributes accordingly:

CSS:

.a2a_button_facebook, .a2a_button_twitter, .a2a_button_whatsapp {
/* demo height - modify as needed */
 width: 500px !important;

/* demo height - alter as required */
 height: 500px !important;

The use of !important may be necessary to override AddToAny's internal styling. The extensive code on linked codepens may make debugging challenging. Starting with basic HTML and CSS coding provides valuable learning experiences compared to relying heavily on pre-existing code snippets.

I have created a straightforward navigation bar example to help you begin:

HTML:

  <nav>
    <ul>
      <li><a href="link 1">Link 1</a></li>
      <li><a href="link 2">Link 2</a></li>
      <li><a href="link 3">Link 3</a></li>
      <li><a href="link 4">Link 4</a></li>
    </ul>
  </nav>

It is crucial to use the <nav> element correctly when structuring a navigation bar.

CSS:

.navbar {
  list-style-type: none;
  padding: 0;
  display: flex;
  flex-direction: row;
  width: 100%;
}

.navbar a {
  display: block;
  padding: 8px;
  background-color: #dddddd;
  width: 100px;
}

The .navbar a padding dictates spacing between elements, while width defines each element's size. Experiment with these values and reach out if you require further assistance!

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

Why Bootstrap 4 collapse feature is not functioning correctly within a ReactJS map component?

I am currently working on a project that requires implementing a collapse feature. The idea is to display all available content when the user clicks the Read More button (which is functioning as intended for collapsing). However, I am facing an issue where ...

Correct the body when the bootstrap navbar collapses

<div class="navbar navbar-inverse navbar-fixed-top" role="navigation"> <div class="container"> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> ...

Shifting gradient hues for illustrations?

One technique I have mastered is creating dynamic gradient colors for text elements using the following CSS: a { &:hover { background: linear-gradient(-45deg, green, yellow, red, blue); background-size: 200% 200%; animation: gradient-movi ...

Creating a circular shape that adjusts to different screen sizes using only CSS

Is there a way to create perfect circles using only CSS without them turning into ovals when using percentage values for height? ...

Is there a way to trigger a function in an AngularJS controller from a Backbone controller?

I've been working on an application that was originally developed using backbone and jQuery, but we had to incorporate new modules built with angular to meet client requirements. Routing in the application is handled by backbone route, and we have suc ...

Pinterest's "Pin it" button causing issues with the 'back' function in Internet Explorer

Recently, I discovered a problem with the "Pin it" button for Pinterest in Internet Explorer (v9 at least). It seems that this button is causing issues with the 'back' functionality in the browser. When right-clicking on it, an entry like '& ...

Having trouble retrieving XSRF-TOKEN from cookie in Next.js (React.js)?

When working with Next.js and Laravel 8 backend, I encountered an issue where I couldn't set the XSRF-TOKEN generated by Laravel on my fetch request for login. Despite being able to see the token in the inspect element > application tab > cookie ...

Switch from using fetch to utilizing axios for making API requests

I used fetch for a 'get' request, but now I want to switch to axios. Can someone please help me convert this code to use axios instead? More details: I am fetching an image and using the blob method to display it to the user. I would like to ach ...

Avoid Scroll Below Stuck Navigation

I've been searching for a solution to my issue for some time now, and while I've come across many articles discussing similar problems, none of them seem to address my specific problem. In my React app, I have a mobile version where users can ta ...

Updating dynamic content in IBM Worklight V6.1 with jQuery Mobile v1.4.3 requires waiting for the DOM to load

I need to dynamically update the content of a div within my HTML page structure. <!DOCTYPE HTML> <html> ... <body> <div data-role="page"> <div data-role="header"> //Image </div> <!-- Th ...

Updating image source attributes for all images with HTML Agility

I'm facing an issue where I need to change all src attributes in the HTML code to absolute paths instead of relative paths. I attempted to solve this problem using HTML Agility: string html = "<body><div><img src=\"/folder/a.png&b ...

Angular2 Window Opener

Trying to establish communication between a child window and parent window in Angular 2, but I'm stuck on how to utilize window.opener for passing a parameter to Angular 2. In my previous experience with Angular 1.5, I referenced something similar he ...

Having trouble resolving row border issues with CSS in DataTables?

I need to enhance the appearance of specific rows in my table by adding a darker border at the bottom. To achieve this, I have assigned a custom class (des-rec-row) to the rows and included the following CSS code: .des-rec-row { border-bottom: 1px soli ...

javascript issue with attribute manipulation

My current struggle involves setting the attribute of an element through programming, but I keep encountering an error in Firebug: obj.setAttribute is not a function. Since I am working with jQuery, allow me to provide some additional code for better conte ...

Is there a way to position the text to the right and the image to the left?

I have written the following code: <!DOCTYPE html> <html> <head> <title>UMass Boston Computer Science Club About page</title> <link href='https://fonts.googleapis.com/css?family=Chakra Petch' rel='sty ...

Leverage NodeJS data within Angular framework

I am working with the following route: Server app.get('/claim/:id', compact.js(['global']), indexController.claim); module.exports.claim=function(req,res){ res.render('claim-note', { title: 'claim', noteId:req. ...

Testing the mongoose.connect callback method in Jest: A step-by-step guide

Currently working on a new Express application and utilizing Jest as the testing framework. All sections of code have been successfully covered, except for the callback of the mongoose.connect method: I attempted to spy on the connect method of the mongo ...

Guide on extracting nested JSON data values using JavaScript

{ "_id" : ObjectId("587f5455da1da85d2bd01fc5"), "totalTime" : 0, "lastUpdatedBy" : ObjectId("57906bf8f4add282195d0a88"), "createdBy" : ObjectId("57906bf8f4add282195d0a88"), "workSpaceId" : ObjectId("57906c24f4add282195d0a8a"), "loca ...

Tips for preserving both existing data and new data within React's useState hook in React Native or ReactJS?

As I dive into learning reactjs, one question that has been on my mind is how to store both previous and upcoming data in useState. Is there a special trick for achieving this? For example: Imagine I enter "A" and then follow it with "B". My goal is to ha ...

In Javascript, we can increment the current date by utilizing the `getDate()`

I am trying to create an if statement in JavaScript; if (nextProcessingDate > today ) { //do something } nextProcessingDate has a timestamp assigned, like 09/07/2014 12:10:17 To assign today's timestamp to the today variable, I am using this c ...