Guide on placing Font Awesome icon on the left side of input group in Bootstrap-vue or Bootstrap 4

I have been searching for a way to add the Font Awesome icon to the input group in Bootstrap-vue, but I couldn't find any helpful information. Most tutorials are for Bootstrap 3 and when I tried a solution from this link, it didn't work for me.

My current setup: https://i.sstatic.net/0oWa8.png

It should resemble this (only the icon, not the entire style): https://i.sstatic.net/1knN4.png

Here's my HTML:

<b-card no-body class="UniqueFullWidth">
  <b-tabs card>
    <b-tab title="Sign up" style="width:auto">
      <br>
      <b-form-input size="lg" placeholder="Full name">
      </b-form-input>
      <br>
      <b-form-input size="lg" placeholder="Username">
      </b-form-input>
      <br>
      <b-form-input size="lg" type="password" placeholder="Password">
      </b-form-input>
      <br>
      <b-form-input size="lg" type="email" placeholder="Email">
      </b-form-input>
    </b-tab>
    <b-tab title="Log in" active>
    <br>
      <b-form-input size="lg" placeholder="Username">
      </b-form-input>
      <br>
      <b-form-input size="lg" type="password" placeholder="Password">
      </b-form-input>
    </b-tab>
  </b-tabs>
</b-card>

Current CSS styles applied:

.UniqueFullWidth .card-header {
  font-size: 1.3em;
}
.UniqueFullWidth {
  width: 400px;
  margin: auto;
}
.UniqueFullWidth .card-header-tabs {
  margin-right: -21px;
  margin-left: -21px;
  margin-top: -13px;
}
.UniqueFullWidth .nav-tabs .nav-link.active {
  color: #000;
}
.UniqueFullWidth .nav-link {
  color: #979faf;
}
.UniqueFullWidth .nav-link:hover {
  color: #62676d;
}
.UniqueFullWidth .nav-tabs .nav-item {
  margin-bottom: -1px;
  flex-grow: 1;
  text-align: center;
}  

Answer №1

Utilize <b-input-group> alongside <b-input-group-prepend>

HTML:

<b-input-group>
  <b-input-group-prepend>
    <span class="input-group-text"><i class="fa fa-user fa-lg"></i></span>
  </b-input-group-prepend>
  <b-form-input class="LoginInput" size="lg" placeholder="Username">
  </b-form-input>
</b-input-group>

CSS:

.UniqueFullWidth .input-group-text {
  width: 48px;
  border-right: none;
  background-color: #ffffff;
}
.UniqueFullWidth [class^="fa-"], [class*=" fa-"] {
  display: inline-block;
  width: 100%;
}
.UniqueFullWidth .LoginInput {
  border-left: none;
}

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

Issue with Box2Dweb's Rope Joint functionality has been identified

I am facing an issue with the Rope Joint code in Box2dweb. Despite running the code in my browser, I am only seeing a blank canvas with no activity. However, when I remove the lines that define the joints (the eight lines following //joints), the code ru ...

Newbie inquiry: How to utilize classes in HTML for CSS implementation?

I'm a beginner in the world of HTML and I have what might be considered as a basic question... Here is the style definition for my header in the CSS file: h1.heading { color: indianred; } I attempted to link it to my HTML file like this, but unfo ...

Mouseover feature for image is functioning, but having issues with alignment

I am currently working on displaying images upon mouse over actions. While the functionality is working perfectly, I am facing an issue where the displayed images appear below and the last image takes up space at the bottom. To rectify this problem, I woul ...

Is there a way to achieve a double background color effect in CSS while ensuring that the text is centered within the second background color element?

How can I achieve a layout similar to the one shown in this image: ul menu li tags Should I use two tags for each element? Here is an example: <ul class="menu"> <div class="outside"><li class="inside"><a href="#">Firefox</a ...

Enlarged text size disrupts alignment of ul menu items

After creating a fixed menu using unordered lists and extensive CSS, I added a custom class button that redirects back to the frontpage. However, I noticed an extra pixel of height in the menu causing alignment issues with the buttons. The big button stick ...

Blazor Razor Component Library (RCL) Lacks CSS IntelliSense

I am encountering an issue with the CSS intellisense in my razor class library (RCL) that houses all the pages of my Blazor application. It appears that the CSS intellisense is not functioning within the RCL unless I modify the RCL .csproj xml tag From Sdk ...

Tips for adjusting the size of grid tiles according to the dimensions of the window within a specific range

I am currently exploring how to replicate the effect found on this webpage: When the window size is adjusted, javascript dynamically resizes the grid tiles between 200 and 240px based on the optimal fit for the screen. Is there a ready-made JavaScript/jQ ...

When the Add button in AngularJS is clicked, a new popup page should appear by concealing the parent page

I am currently working on a project that involves using the AngularJS/Breeze framework within the HotTowel Template. One of the requirements I have is to include a button/link labeled "Add" on the parent.html page. When this button is clicked, it should t ...

Basic alignment in a table and on a webpage using HTML

I have a basic HTML table that needs some alignment adjustments. <table align="center" border="1" cellpadding="0" cellspacing="0" style="width:1000px"> <thead> <tr> <th scope="row">BB<br /> ...

Show the textbox automatically when the checkbox is selected, otherwise keep the textbox hidden

Is it possible to display a textbox in javascript when a checkbox is already checked onLoad? And then hide the textbox if the checkbox is not checked onLoad? ...

Utilizing HTML and JavaScript to Download Images from a Web Browser

I'm interested in adding a feature that allows users to save an image (svg) from a webpage onto their local machine, but I'm not sure how to go about doing this. I know it can be done with canvas, but I'm unsure about regular images. Here i ...

Seeking assistance in setting up a search view and integrating it into an HTML page with data from my Django database

Currently engaged in the development of a DJANGO website where users can input words and their associations for better recall. The word insertion feature has been successfully implemented. However, facing a roadblock while trying to set up the word search ...

Twist two images in opposite directions around the avatar picture using CSS

Upon hovering over the central image, I want two circles to animate in opposite directions simultaneously. So far, I have only been able to animate them separately by individually hovering over the objects. This is what I'm aiming for: Check out my ...

I have tried implementing "display:inline-block" but my DIV stubbornly refuses to stay on the same line

I need to align two block elements horizontally, one being a FORM and the other a DIV. <div id="miningArea"> <form id="curWorkForm">...</form> <div id="buttonDescription"> To start, click the "Start" button. < ...

How can I make the navbar in Angular stay fixed in place?

After using the ng generate @angular/material:material-nav --name=home command to create a navbar, I am trying to make it fixed at the top while scrolling. I attempted using position: fixed; on my mat-sidenav-content but it didn't work. Does anyone ha ...

Maintaining hover effects even when elements are not in view

I am facing an issue with my absolutely positioned <div> (which serves as a menu) located in the corner of a webpage. The problem arises when I try to animate it on hover, but as soon as the cursor moves beyond the viewport, the hover action stops. I ...

Gradually fade with JavaScript

My JavaScript code below is used to recursively reload a specific DIV with the results of a data query. The issue I'm facing is that each time the DIV, identified by id="outPut", is reloaded, all the data fades in and out due to the fadeTo function. ...

Ensuring the text is positioned centrally and at the bottom of a table cell

Is there a way to center and align text at the bottom of a cell in table? This is my desired layout: ...

Centralize the X button using CSS

My latest challenge involves creating a close button using CSS to close a tag. I combined techniques from an article on Patterns for Closebuttons, along with a css-only tutorial for crafting an X from this Close Button using CSS. However, I've run in ...

Unable to open ngx-bootstrap dropdown in Angular 4 with Bootstrap 4

I'm struggling to understand the issue at hand here - I've implemented ngx-dropdown code according to the documentation: home.component.html <div class="btn-group" dropdown> <button dropdownToggle type="button" class="btn btn ...