Guidelines for positioning social media icons to the right of the collapsible navigation bar in Bootstrap 3

I am having trouble aligning my social media icon with the navbar menu to the right. There seems to be a gap when I try to do it.

The social icon is currently in a separate row, while the navbar is also in a separate row. I just want to align them both to the right.

Unfortunately, using padding-right and pull-right does not seem to be working. Any help would be greatly appreciated. Thank you in advance.

CSS code

.navbar-collapse {
    padding-right: 0px;
    margin-right: 0px;
}

HTML codes

<div class="row" style="height: 40px;">
    <div class="container">
        <div class="social pull-right">
            <ul>
                <li><a href="#"><i class="fa fa-lg fa-phone"></i></a>+65 652 225 25</li>
                <li><a href="#"><i class="fa fa-lg fa-weixin"></i></a></li>
                <li><a href="#"><i class="fa fa-lg fa-envelope-o"></i></a></li>
                <li><a href="#"><i class="fa fa-lg fa-facebook"></i></a></li>
            </ul>
        </div>
    </div>
</div>

<!--Navigation Menu and Carousel -->
<div class="row" style="background-color: black">
    <div class="container">
        <nav class="navbar navbar-inverse" role="navigation">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a class="navbar-brand" href="index.html">
                    <img src="images/logo.png" alt="img">
                </a>
            </div>
            <div class="navbar-collapse collapse pull-right">
                <ul class="nav navbar-nav">
                    <li><a href="index.html">HOME</a></li>
                    <li><a href="blog.html">SERVICES</a></li>
                    <li><a href="clients.html">WORKS</a></li>
                    <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown">ABOUT <b class="caret"></b></a>
                    <ul class="dropdown-menu">
                        <li><a href="http://www.facebook.com">Facebook</a></li>
                        <li><a href="http://www.twitter.com">Twitter</a></li>
                        <li><a href="https://plus.google.com">Google+</a></li>
                        <li><a href="http://www.linkedin.com">LinkedIn</a></li>
                    </ul>
                </li>
                    <li class="active"><a href="contact.html">CONTACT</a></li>

                </ul>
            </div>
        </nav>
    </div>
</div>

Answer №1

give this a shot

.connect ul li{
       display:inline-block;
list-style-type:none;
margin-right:15px
    }


<div class="connect col-lg-6 pull-right">

VIEW DEMO

Answer №2

Consider implementing the following code snippet, which utilizes the navbar-right class provided by Bootstrap:


        <div class="navbar-collapse collapse pull-right">
            <ul class="nav navbar-nav">
                <li><a href="index.html">HOME</a></li>
                <li><a href="blog.html">SERVICES</a></li>
                <li><a href="clients.html">WORKS</a></li>
                <li class="dropdown">
                <a href="#" class="dropdown-toggle" data-toggle="dropdown">ABOUT <b class="caret"></b></a>
                <ul class="dropdown-menu">
                    <li><a href="http://www.facebook.com">Facebook</a></li>
                    <li><a href="http://www.twitter.com">Twitter</a></li>
                    <li><a href="https://plus.google.com">Google+</a></li>
                    <li><a href="http://www.linkedin.com">LinkedIn</a></li>
                </ul>
            </li>
                <li class="active"><a href="contact.html">CONTACT</a></li>

            </ul>

            <ul class="nav navbar-nav navbar-right">
                <li><a href="#"><i class="fa fa-lg fa-phone"></i></a>+65 652 225 25</li>
                <li><a href="#"><i class="fa fa-lg fa-weixin"></i></a></li>
                <li><a href="#"><i class="fa fa-lg fa-envelope-o"></i></a></li>
                <li><a href="#"><i class="fa fa-lg fa-facebook"></i></a></li>
            </ul>

        </div>

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

Failure to apply Bootstrap Stylesheet

On certain pages, I have included Bootstrap. On one particular page, I have an alert styled with Bootstrap. This is how it's defined: $('#wrongPasswordDiv').html('<br/><div class="alert alert-danger" id="wrongPWAlert" role= ...

Unable to trigger JQuery .blur event

I am currently working on implementing server-side validation for an input field that needs to be validated when it loses focus. However, I'm running into an issue where the alert is not triggered when the input field loses focus. Here's a snipp ...

Hold off on showing the image until it has finished loading

// Here's the code snippet angular .module('imgapp', []) .controller('mainCtrl', mainCtrl); function mainCtrl() { var vm = this; vm.first = { title: 'Image 1', url: 'http://www.image-mapper.com ...

Update the contents of a neighbor div within the same parent element using jQuery

Attempting to set the range slider value within the slider parent sibling var updateRangeSlider = function() { var slider = $('.range-slider'), range = $('.range- value = $('.range-slider__value'); sli ...

"Exploring the Power of Internal Hyperlinks in HTML

As I embark on my first website building journey, I am faced with a dilemma regarding internal links. While everything runs smoothly locally, none of the internal links seem to work once the site is live. Take for instance this internal link: <a href =& ...

Conflicting styling issues with hover colors on unordered list items

I am experiencing an issue with conflicting color schemes in a nested ul menu. The main menu items are all white, and the top menu item links turn orange on hover as intended. However, the sub menu items need to have white text on an orange background (whi ...

Having trouble making the FileField optional in Django - need assistance troubleshooting the error

I am currently attempting to upload a file. The uploading process is functioning correctly. Here is my Models.py code: class I(models.Model): top = models.ForeignKey(T) imgfile = models.FileField(upload_to='static/Uploaded_Images', blan ...

The React modal refuses to disappear, stubbornly clinging to the original component it sprang from

Hey there, I'm a beginner in learning React and I'm encountering an issue with my popup modal component. Even after showing the modal, I can still interact with and click on the main UI elements. Can anyone assist me with this problem? https://i ...

positioned the div within the StickyContainer element to ensure it remains fixed in place

I've been working on making a div sticky in a React project. To achieve this, I added the react-sticky package to my project. I placed the div within the StickyContainer component as per the documentation. Although there are no visible errors, the sti ...

Is it possible to use HTML elements to trigger actions in order to display or conceal divs using JavaScript?

Beginner - I am currently working on a webpage using TinyMCE wysiwyg and I would like to implement a functionality where I can display or hide certain divs upon clicking a link/button. Unfortunately, due to the structure of the page, it seems that I ca ...

Monitor the incoming POST request

Is there a way to monitor incoming post requests in a form? I have the following form: <form method='post'> <input type='text' name'test' /> <input type='submit' name'submit' /> </for ...

What is causing all webkit browsers to overlook the z-index in my code?

I have removed all unnecessary elements from my webpage to focus on reproducing a specific issue. HTML: <html lang="en-us"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initi ...

Conceal a script-generated div using CSS styling

Using the code below, you can create an HTML chatbox with a link in the top panel and multiple child divs. The structure is as follows: cgroup is the parent of CBG, which is the parent of CGW, and CGW is the parent of the div I want to hide. How can I u ...

Classic design of the shadow element

I have main.js and index.html below class CustomTagA extends HTMLElement { constructor() { super(); const shadow = this.attachShadow({mode: 'open'}); const wrapper = document.createElement('h1'); ...

Why is the div element within the container not automatically occupying 12 columns, but rather only 1?

I'm struggling to comprehend the bootstrap grid system, as explained in Murach's .Net book. Please take the time to read through the entire post. I am aware of the solution (<div class="col-lg-12">Col x</div> works), but I am curious ...

Clicking a button with Java Selenium

While trying to navigate all the pages on a website, I encountered an issue where after scrolling to the second page, I received an exception stating that the element does not exist on the page. Upon further investigation, I realized that the CSS selecto ...

Struggling to locate the distinctive XPath for the button

I am facing a situation where the XPath is non-unique and identifies 3 elements on the page that change positions upon refresh: <div class="col-xs-12 Hover"> <button data-testid="continueCheckoutButton" ng- class="continueDellMetricsC ...

associating functions with various events that require arguments

I am working with two event listeners that trigger separate functions, but I believe it might be more efficient to have them trigger the same function instead. These event listeners are monitoring keystrokes and the mouse wheel. $(document).mousewheel(on ...

Adjusting the content of mat-cards to fill in blank spaces

I have encountered an issue with the alignment in a list using mat-card. Here is my current layout: https://i.stack.imgur.com/VKSw4.jpg Here is the desired layout: https://i.stack.imgur.com/8jsiX.jpg The problem arises when the size of content inside a ...

Adjusting the height of a container dynamically in React while flex items wrap using CSS

In my React project, I have a container called "answers-container" with multiple buttons inside it, laid out using flexbox with flex-wrap: wrap to allow them to wrap onto the next line when the container width is exceeded. However, I'm facing an issu ...