How can I position the hyperlink inline with the font-awesome Icon?

Hey everyone, I'm having some trouble creating a top info bar in Bootstrap 4.1.3 with Font-awesome 5.5. I want to include essential details like phone number, email address, and social icons, but whenever I try to add a hyperlink after the icon, it drops down to the next line. I've tried multiple methods but haven't had any success aligning it properly in one line.

Could someone please take a look at my code?

<!DOCTYPE html>
<html lang="en>

<head>
  <meta charset="UTF-8>
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  <title>Anything</title>
  <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" />
  <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.5.0/css/all.css" />
</head>

<body>
  <div class="container-fluid">
    <div class="row">
      <div class="top-info d-sm-none d-md-block">
        <div class="col-md-8">
          <ul class="list-inline">
            <li class="list-inline-item"><i class="fas fa-sign-in-alt"></i><span><a href="#">Login</a></span></li>
            <li class="list-inline-item"><i class="fas fa-sign-in-alt"></i><span><a href="#">Login</a></span></li>
            <li class="list-inline-item"><i class="fas fa-sign-in-alt"></i><span><a href="#">Login</a></span></li>
          </ul>
        </div>
        <div class="col-md-4">
          <i class="fas fa-sign-in-alt"></i><span><a href="#">Login</a></span>
        </div>
      </div>
    </div>
  </div>
</body>
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"></script>

</html>

Answer №1

After reviewing your code, I made some adjustments by including the class col-md-8 in the problematic div. The updated code now looks like this: <div class="col-md-8">. You can view the revised result by visiting this link https://codepen.io/ekk0/pen/xyOoBB?editors=1000. It seems that using col-md-4 initially may have caused some issues. I hope this resolves the problem for you!

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 found - PHP if condition inside HTML td element

Whenever I open my browser, I encounter this error message: Parse error: syntax error, unexpected 'if' (T_IF) I have been working on creating an HTML table to display prices for a Woocommerce product. Although I've come across similar issu ...

Spin a sphere within a semicircle using html and css

I have been working on a project to animate a ball inside a crescent shape using HTML and CSS. You can check out my codepen here. However, I am facing an issue where the ball is currently stuck at the top of the crescent. I would greatly appreciate any as ...

Delete any content that is not enclosed in tags

I am struggling with manually rendering Django forms and it's producing the following code. Is there a way to remove text without HTML tags, such as "Currently:" and "Change:", which are difficult to style with CSS? <div class="row align-cente ...

Incorporating HTML into the Ajax Response

I recently encountered a strange issue with a service that returns an HTML page as the AJAX response. This page contains a form that is automatically triggered by scripts within the page, resulting in a POST request being sent when the page is rendered. My ...

Transition smoothly between images using CSS in a continuous loop

Is it possible to create a looped fade effect between images using only CSS, without the use of JavaScript? I attempted to achieve this by utilizing keyframes but was unable to succeed. Any guidance or assistance would be greatly appreciated. Thank you! ...

I'm having trouble displaying the X's and O's in my tic tac toe JavaScript game. Any suggestions on how to resolve this issue?

After following a couple of online tutorials for the tic tac toe project, I encountered an error in both attempts. The X's and O's were not displaying even though all other features were working fine. Below are my codes for HTML, CSS, and JavaScr ...

Modify the textfield label color using Material-UI

Hey there! I'm running into a little issue when trying to change the color of the text label in a MUI text field. I've successfully customized the border colors and hover states, including the label, but for some reason, I can't seem to get ...

What is the best way to alter the background-color of an element that is contained within a GatsbyJS component, depending on the specific page where the component is being utilized?

As a first-time GatsbyJS website builder, I am working on creating reusable components for my site. One of these components is the footer, and I have already structured it. Now, I have a dilemma - I want to change the color of a specific <div> within ...

transform SQL data into HTML viewing

I am facing an issue trying to display information from a SQL database on an HTML page. Unfortunately, my code is not returning any results at all. <?php $host = "DRHATEM-PC"; $user = "sa"; $pass ...

What causes jquery-ui resizable to set the width of the div with the "alsoResize" property?

I have created a series of divs structured like this: <div id="body_container"> <div id="top_body"> </div> <div id="bottom_body"> </div> </div> Additionally, I have implemented the following funct ...

Accessing getUserMedia within Internet Explorer 11 or utilizing MediaStream on IE 11

I am attempting to utilize the getUserMedia function in IE 11 with the help of the temasys plugin. However, IE does not support the MediaStream instance returned by getUserMedia. Below is a snippet of my code: import React from 'react' import { ...

Issue with readonly is preventing the ability to alter the font color of the input

I need to change the font color of a disabled input. When it is disabled, it appears gray and I want it to be black instead. I attempted to use readonly but that did not have the desired effect, and now the input is showing [object Object]. Below is my HTM ...

The method for transforming all headers into permalinks with jquery/javascript

I am looking for a way to transform all headers on a page into clickable permalinks using jQuery or JavaScript. Here is the HTML code: $('h3').each(function() { var id = $(this).attr('id'); if (id) { //Check if the element has a ...

Prevent floating labels from reverting to their initial position

Issue with Form Labels I am currently in the process of creating a login form that utilizes labels as placeholders. The reason for this choice is because the labels will need to be translated and our JavaScript cannot target the placeholder text or our de ...

I am encountering issues with my XPath in certain scenarios

When attempting to do an assertion with the total of a dynamic table, I am encountering difficulties writing XPath that works for all scenarios. The issue arises because the table sometimes contains only 1 image and other times it may contain 5 images. In ...

I am attempting to adjust the CSS code so that it does not shrink when clicked on. How can I prevent this from happening?

Here is the element I am attempting to modify. I attempted &:active { flex:7;} but upon releasing the left click button, it reverted back to its original size. I was aiming for something similar to this <h1>Gallery</h1> < ...

Checking and locating elements using Jquery's distinctive style

Within my code, I am searching for the DIV element that has the class .se and also has the attribute display: block. Once found, I need to retrieve the ID of this particular DIV. Unfortunately, it seems like my current approach is not correct. var usedse ...

Ensure that the background image is perfectly fitted within the second background image

I am facing a challenge with two images - a frame and another image that needs to fit perfectly inside that frame. The tricky part is ensuring that the layout remains responsive. The two images are: https://i.sstatic.net/XWsTq.png Here is how it should ...

Tips for Displaying and Concealing Tables Using Radio Buttons

Does anyone know how to refactor the jQuery code to toggle between two selection options (Yes and No)? This is the jQuery code I have tried: $(document).ready(function() { $("#send_to_one").hide(); $("input:radio[name='decision']").chan ...

Restrict the Number of Columns in GridView

I am currently working with a gridview that displays product information. I'm trying to find a way to limit the description field so that only the first few lines are shown if it is too long, and also resize the image to fit into the image column whil ...