Aligning social icons to the right within the navigation bar

As I construct my website, my vision includes a collapsible navigation bar in the top left corner and a social media bar in the top right corner. It is imperative to me that the social icons remain aligned with the navigation links at all times.

To achieve this layout, I have devised a plan: creating a row with two columns. The first column houses the navigation bar, while the second column contains all the social media icons. By utilizing "justify-content-between," I intend to position these two elements at opposite ends of the row.

I am making progress towards my goal. The collapsible navigation bar and the social links are in place.

However, I have encountered an issue where the social bar appears adjacent to the navigation bar rather than in the top right corner. This might be due to the fact that my row does not occupy the entire width of the page.

Below is the code snippet relevant to this matter:

<nav class="navbar navbar-expand-sm navbar-light bg-white">
    <div class="row justify-content-between align-items-baseline">
        <div class="col-auto">
            <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent">
                <span class="navbar-toggler-icon"></span>
            </button>

            <div class="collapse navbar-collapse" id="navbarSupportedContent">
                <ul class="navbar-nav nav-fill">
                    <li class="nav-item"><a class="nav-link active" href=".">Home<span class="sr-only">(current)</span></a></li>
                    <li class="nav-item"><a class="nav-link" href="teaching">Teaching</a></li>
                    <li class="nav-item"><a class="nav-link" href="research">Research</a></li>
                    <li class="nav-item"><a class="nav-link" href="outreach">Outreach</a></li>
                    <li class="nav-item"><a class="nav-link" href="personal">Personal</a></li>
                    </li>
                </ul>
            </div>
        </div>

        <div class="col-auto">
            <a href="mailto:<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="ef8e9d859a818caf9f869b9bc18a8b9a">[email protected]</a>" target="_blank"><img src="https://img.icons8.com/material-sharp/24/000000/important-mail.png"/></a>
            <a href="https://www.twitter.com/arjunc12" target="_blank"> <img src="https://img.icons8.com/fluent/24/000000/twitter.png"/></a>
            <a href="https://www.instagram.com/arjunc12" target="_blank"><img src="https://img.icons8.com/fluent/24/000000/instagram-new.png"/></a>
            <a href="http://writers-fakeblock.blogspot.com/" target="_blank"><img src="https://img.icons8.com/color/24/000000/blogger.png"/></a>
        </div>
    </div>
</nav>

Displayed above is what the current setup looks like. In the image provided, you can observe how the social bar needs to be adjusted to align with the far right side.

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

If you wish to view the outcome for yourself or examine the complete source code, please follow this link to access my website.

I humbly request your kindness as I traverse through the world of web programming as a novice. There may be deeper complexities at play due to my approach being quite ad-hoc and non-idiomatic.

Update: Resolving the situation involved realizing that the navigation should be enclosed within the row/column structure instead of vice versa.

Answer №1

apply the justify-self-end styling to the container containing social icons.

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

Building and saving an HTML webpage using Node.js: A step-by-step guide

Using node.js, I developed an application that gathers data in a MongoDB database. For example: name: John pagename: mypage links: [link1, link2, link3] The task at hand is to generate static HTML pages with the format pagename.mydomainname.com, and ins ...

Get an ICS file as text using JQuery

As a newcomer to JQuery and JS, I seek your understanding for any mistakes I may make. My current goal is to extract the text from an ICS file (e.g. BEGIN:CALENDAR....) using JavaScript. Here is a simple HTML file I am working with: <html> <b ...

Footnote fiascos

I am currently in the process of creating a footer for my webpage and have implemented the following CSS styling: #footer { height: 100px; background-color: #F3F3F3; position: absolute; bottom: 0; } Although the footer is displaying at th ...

Tips for fixing alignment problems using CSS

I am experiencing a problem where I am unable to figure out how to align the content in one column with text positioned next to it in a right-aligned format. /* Personal Details */ .personal-info { width: 90%; padding: 25px; border-bottom: 1px so ...

Make changes to external CSS using HTML and JavaScript

Is it possible to dynamically change the value of a background in an external CSS file using JavaScript? Currently, all my pages are connected to a CSS file that controls the background for each page. I am attempting to modify the background by clicking a ...

Checking for CSS-truncated text with JavaScript

I am currently working on a JavaScript project to determine if text is truncated. While I found a useful solution mentioned here, there is one edge case that needs to be addressed. Despite the visual truncation of the text, the first block on mouse hover i ...

What could be causing the issue of HTML Button not functioning properly with jQuery Webpack?

I'm currently using webpack to build my HTML and javascript files. I have a function defined in index.js and I've attempted the solutions mentioned here, but none of them seem to work for calling the function onclick button. Here is the HTML cod ...

How to ensure a table in MaterialUI always maintains full width without requiring horizontal scrolling in CSS?

After attempting to allocate each widthPercent value on the TableHeader so they sum up to 100%, I am still experiencing the presence of a scroll bar. I have tried setting fixed widths for each column, but this results in excess space on the right side dep ...

Scrolling with JQuery Sortable will go up in the list, but it won't allow for

My current issue revolves around a problem in JSP, but for better understanding, I have replicated the issue using HTML. The main page involves using sortable to enable drag and drop rearrangement of elements (list items). However, the scrolling behavior i ...

Ensure the table row remains on one page when printing or viewing the print preview

I'm currently dealing with an html report that contains a table, which can be seen here http://jsfiddle.net/fhwoo3rg/2/embedded/result/ The issue arises when trying to print the report, as it breaks in the middle of a table row like this: https://i ...

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> ...

Enabling users to create custom layouts by writing CSS that is stored in the database

I am currently in the process of developing a web application using Ruby on Rails that allows users to customize their personal blog pages. I am seeking advice on the most effective ways to achieve this. While I believe Liquid for templating is a good opt ...

The first-child and last-child selectors are not working properly in the CSS

In the family of elements, the first child should proudly show off the image icon for home while the last child remains humble without any background imagery: Check out the evidence here: http://jsfiddle.net/gUqC2/ The issue at hand is that the first chi ...

Obtaining HTML content using Java

I received my personal data download from Facebook and decided to have some fun with it. I'm currently trying to isolate a specific group chat that I am a part of. The file size I am working with is 18 kB, filled with HTML code within tags but lackin ...

Tips for preventing the direct copying and pasting of JavaScript functions

Repeating the process of copying and pasting functions such as loadInitialValue(), loadInitialValue2(), loadInitialValue3(), is quite monotonous. This is the repetitive code snippet that I have been working on (when you click on "Mark as Read," the title o ...

My Bootstrap 4 table is not displaying as responsive

Need assistance with displaying a table in a Bootstrap 4 HTML template in a 320x480 view. The table is not responsive even when the .table-responsive class is added. Any idea what could be causing this issue? Here is the HTML code snippet with the table: ...

The options in the drop-down menu appear to be stuck and remain in place

Can someone with expertise lend me a hand? I've been racking my brain over this issue, and while I feel like I'm on the right track, I just can't seem to make my sub-sub menu items drop down to the right on hover. I suspect there might be c ...

Clicking on links will open them in a separate tab, ensuring that only the new tab

Is there a way to open a new tab or popup window, and have it update the existing tab or window whenever the original source link is clicked again? The current behavior of continuously opening new tabs isn't what I was hoping for. ...

Adjust the size of a div element dynamically to maintain the aspect ratio of a background image while keeping the

Utilizing the slick slider from http://kenwheeler.github.io/slick/ to display images of varying sizes, including both portrait and landscape pictures. These images are displayed as background-image properties of the div. By default, the slider has a fixed ...

Clicking to remove added child element

I have written a script that creates an image popup when the site loads. Here is the code: <script type="text/javascript"> function showPopup() { var div = document.createElement('div'); div.className += 'popup'; div.inne ...