Attempting to relocate the final two links within my navigation div to the opposite side of the container div

Hey there! I've been trying to figure out how to move my 'Facebook' and 'Twitter' links to the right side of my navigation bar while keeping all the other links on the left. It's been quite a challenge so far!

I've been going through my HTML code but haven't been able to spot where the problem lies. Here's what I have:

<!DOCTYPE html>
<html>
<head>
<link href="dropdown-menu.css" media="screen" rel="stylesheet" type="text/css" />
</head>

<body>

<br />
<br />


<div id="navdiv">

<ul id="navigation" class="nav-main">

    <li class="list"><a href="index.html">PORTFOLIO</a>
    <ul class="nav-sub">
    <li><a href="logo.html">LOGO DESIGN</a></li>
        <li><a href="clothing.html">CLOTHING DESIGN</a></li>
        <li><a href="photoshop.html">PHOTOSHOP</a></li>
        <li><a href="layout.html">LAYOUT</a></li>   
    </ul>
    </li>
    <ul>
   <li><a href="about.html">ABOUT</a></li>
    </ul>
    </li>
    <li><a href="contact.html">CONTACT</a></li>
    <li class="social"><a href="https://www.facebook.com/dbgraphicdesign" title="Facebook"><img src="images/facebook.png"></a></li>
    <li class="social"><a href="https://twitter.com/dbergmandesigns" title="Twitter"><img src="images/twitter.png"></a></li>

</ul>



</div>
</body>
</html>

The CSS styling is as follows:

#navigation{
    margin:auto;
    width:850px;
    height:45px;
    background-color:rgba(194, 6, 6, 0.6);

}

ul.nav-main,
ul.nav-main li{
    list-style: none;
    margin: 0;
    padding: 0;
}

ul.nav-main{
    position: relative;
}

ul.nav-main li:hover > ul{
    visibility: visible;
}

ul.nav-main li.hover,
ul.nav-main li:hover{
    position: relative;
    cursor: pointer;
    background:rgba(50, 50, 50, 0.9);
}

ul.nav-main li{
    float:left;
    display:block;
    height: 45px;
    color: #ededed;
    font: 14px Arial, Helvetica, sans-serif;
}

ul.nav-main li a{
    display:block;
    padding: 16px 16px 0 16px;
    height: 35px;
    color: #ededed;
    font: 14px Arial, Helvetica, sans-serif;
    text-decoration:none;
}

ul.nav-main li a:hover{
    color:#ededed;
}

ul.nav-sub{
    visibility: hidden;
    position: absolute;
    padding:5px;
    top: 45px;
    left: 0;
    background:rgba(194, 6, 6, 0.8);
}

ul.nav-sub li{
    list-style:none;
    display:block;
    padding-bottom:3px;
    height: 22px;
    float: none;
    width:120px;
    background: none;
}

ul.nav-sub li a{
    list-style:none;
    display:block;
    padding: 6px 5px 6px 5px;
    height: 15px;
    width:165px;
    background: none;
    font: 12px Arial, Helvetica, sans-serif;    
}

ul img{
height:25px;
}

If anyone has any insights or solutions, I would greatly appreciate it!

Answer №1

Give this a shot:

ul.nav-main li.social {position: absolute; right: 0;}

Answer №2

In the 4th lesson, detailed explanations are provided

Here's a different approach:

    <div class="menu">
        <ul>
            <li></li>
            <div class="social-links">
                <li></li>
                <li></li>
            </div>
        </ul>
    </div>

To style this, apply the following CSS:

    .class menu {
        position: relative;
    }

    .class social-links {
        position: absolute;
        right: 0;
        /* optionally
        top: 0; */
    }

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

How can I make sure my rows are properly aligned using the Grid

Looking at the image below, I am attempting to align "Ticket Number" and "Email" using a Grid: View My Result Image <Grid container direction="row" justifyContent="flex-start" alignItems="stretch" style={{ pad ...

Tips for customizing the appearance of a chosen radio button

Here is my HTML code snippet: <div class="col-md-12 money-radio-container"> <input type="radio" name="optradio" class="money-radio" value="10">10 <span>$</span> <input type="radio" name="optradio" class="money-radio" val ...

Exploring JavaFX and FXML TreeTableView customization for column and header styles

I've been working on a JavaFX project and I'm having trouble customizing the style of the TreeTableView header or columns, like changing the color, width, font size, etc. I've tried using various codes like these but none seem to work. ...

What is causing the discrepancy in height between my parent DIV and its children?

I've been grappling with this issue for quite some time now and unfortunately, I haven't been able to come up with a solution. Within my design, I have a frame that consists of a top box, a left box, a right box, and a middle box that contains th ...

Am I incorrectly linking Javascript/CSS files/pages?

<script src="scripts/lib/angular.min.js"></script> <script src="scripts/lib/angular-route.min.js"></script> <script src="scripts/lib/angular-animate.min.js"></script> <script src="scripts/lib/jquery.min.js"></sc ...

Tips for verifying on the click of a button

Having trouble solving my issue as a newbie to HTML and jQuery. The problem at hand is: In my website, I need to implement username validation. This validation involves checking the entered username against a MySQL database. If the database contains the ...

Unable to change the value of a variable in a function in AngularJS

Calling all developers for assistance! I am experiencing an issue with updating a value dynamically inside an AngularJS controller that is being passed to an HTML tag. Everything works perfectly when updating the value outside of a function: var app = angu ...

Setting the height and width to 100% causes the element to slightly protrude

After setting the height and width of a canvas to 100%, I noticed that instead of fitting the screen perfectly, it slightly exceeded the boundaries, causing a scroll bar to appear allowing me to scroll just a few pixels up, down, left, or right, even after ...

Alter the top property of CSS using JavaScript

Hey there! I'm currently working on a project where I want to gradually change the background when a button is clicked on my website. Below you'll find snippets of JavaScript and HTML code that I'm using for this purpose. Can you take a look ...

Icons on Google Calendar events - Mini images beside your schedule

I'm in the process of developing a website where I plan to integrate Google Calendar. I want to include a small icon next to specific events to denote certain details. While the "categories" feature in Google Calendar allows me to assign highlight col ...

Updating the chosen value in an HTML select menu dynamically using PHP

I understand that there are existing examples discussing how to dynamically set the selected tag in an HTML option tag. However, I am encountering a complex issue involving break statements and quotations while trying to accomplish this. In my code: whil ...

Differences in functionality across various browsers when dealing with complex subgrid structures

After nesting a subgrid inside a padded subgrid within a grid, I noticed varying behavior across different web browsers. Chrome/Edge (Windows) Firefox (Windows) Safari MacOS https://i.stack.imgur.com/uHlto.png https://i.stack.imgur.com/SGxuC.png ht ...

A guide to aligning text on the right side of an image with HTML and CSS

Looking for assistance to align text on the right side of an image at the same level. Below is the code I have: <a class="following-row" href="index-2.html?pid=2306"> <img alt="Girls logo" src="photos/users/35257/resized/9fd79 ...

Utilizing AngularJS to include information into JSON-LD

As a newcomer to AngularJS, I find myself stuck in one of my projects. My goal is to convert the user-entered data in a form into the format: << "schema:data" >> and then push and display it within the @graph of the json-ld. Here are my HTML an ...

Unable to get CSS Filter to function properly in Firefox

I'm having trouble with the CSS filter on my Firefox (15.0) browser. Here is the HTML code: <div class="google"> <img src="https://www.google.com/images/srpr/logo3w.png"> </div> And here is the CSS code: .google{ -moz ...

Step-by-step guide to achieving a File div effect using CSS

Wondering how to achieve this specific effect within a div using CSS? click here for visual reference I attempted it using the before and after elements, but I struggle with these tags: check out this image for details Apologies if my question is unclear ...

jQuery checkbox toggles multiple divs instead of targeting specific ones

I have set up my page to display divs containing posts using a specific format. The divs are structured as follows (replacing # with the postID from my database): <div id="post_#> <div id="post_#_inside"> <div id="like_#"> ...

How can you utilize jQuery to export multiple-page HTML content into a PDF document?

I'm having trouble exporting HTML to PDF using jQuery, especially when the HTML content spans multiple pages in the PDF file. Below is my current code snippet: $("body").on("click", "#downloadPDF", function () { html2canvas($('#dow ...

The button labeled as "hamburger" on my navigation bar seems to be malfunctioning (using bootstrap)

Recently, I've been facing an issue with the "hamburger" button in my navbar. Whenever I click on it, nothing seems to happen. This was not a problem before, and now I can't seem to figure out what went wrong or where the error lies. If anyone c ...

The act of resizing a window causes the text to be forcibly expelled from its containing div

When you hover over an image in a grid, text and a button appear. However, when the window is resized, the content ends up overflowing out of the div. This issue is part of my first project that I am working on during a bootcamp. I have decided to keep th ...