What is the best way to include small text below an input-group?

I'm attempting to insert a small text below an input group, but it's not working the same way as it does with form-groups.

In this example, I want the help text to be positioned under the input rather than beside it. Here's what I mean by input groups: https://getbootstrap.com/docs/4.0/components/input-group/

Here's the jsfiddle link if you want to experiment with it: https://jsfiddle.net/c59hnx8v/

By the way, this is just for demonstration purposes.

Answer №1

There is a similarity to the question discussed here, and the issue arises due to the display:flex property of Bootstrap 4 input-group.

The easiest solution is to ensure that the help-text has a width of 100%, which can be achieved using the w-100 class. This eliminates the need for any additional CSS.

<div class="col">
      <label for="demo">Enter your email here:</label>
      <div class="input-group mb-3">
        <input type="text" class="form-control" placeholder="Email" id="demo" name="email">
        <div class="input-group-append">
          <span class="input-group-text">@</span>
        </div>
        <small class="w-100">Help text</small>
      </div>
  </div>

Visit this link for more details

Answer №2

Your design calls for adjusting the width of the small text to match its container:

.input-group-append + small {
  width: 100%;
}

Answer №3

Upon testing @Zim's solution, I discovered that it was removing the radius from the append section. The following adjustment resolved this issue for me...

    <div class="col mb-2">
        <label for="demo">Enter your email address:</label>
        <div class="input-group ">
            <input type="text" class="form-control" placeholder="Email" id="demo" name="email">
            <div class="input-group-append">
                <span class="input-group-text">@</span>
            </div>
        </div>
        <small class="w-100">Additional information</small>
    </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

Expanding the size of the number input in Twitter Bootstrap to accommodate changing content dimensions

I have a numeric input field that I want to customize in terms of width. I need the field to start with a minimum width so that -1, the default value, fits nicely inside. As the value changes, whether decreasing to -100 or increasing to -1,000 and beyond ...

Secret message concealed within the depths of my Bootstrap 5 Side Navbar

I have successfully created a side NavBar using Bootstrap 5, but I'm facing an issue where my text is getting hidden behind the navbar. Any suggestions on how I can resolve this? Below is the code for my side Navbar: const Navbar = ({ handleClick, is ...

How to Ensure an Element Appears Above Another Despite Z-Index Troubles?

After conducting approximately 2 hours of research on this topic, I was unable to find clear answers or solutions. Hence, I have decided to address the issue here. The problem I'm facing is as follows: Due to the nature of HTML/CSS, it seems impossi ...

Utilizing CSS for displaying and hiding content based on its unique identifier

Is it possible to show/hide a div using only CSS based on its ID? Showcasing this functionality in jQuery or vanilla JavaScript is straightforward, but can the same effect be achieved with pure CSS? The checkbox hack requires a specific structure to func ...

Having trouble adjusting the vertical position of jQuery Spinner buttons

I'm attempting to customize the jQuery spinner with styling applied like this: <span class="ui-spinner ui-widget ui-widget-content ui-corner-all" style="height: 14px;"> <input id="testSpinner" class="ui-spinner-input" name="value" aria-value ...

CSS: A guide to creating layouts

I wrote this code snippet to display a table: <div class="topologyBalloon" id="bl_c2f03b99-6d62-43c4-9a35-4b4cbf22a7db"> <a href="#close" class="closeTopologyBalloon">×</a> <div class="contentBody"> <table class="deta ...

Replicating DIV element with input field

Once again, I find myself stuck in my attempt to duplicate a DIV and its form elements using jQuery. Button: <div class="addNew" id="addSkill">Add Skill <i class="icon-plus"></i></div> This is the Div and contents that I want to ...

Creating specialized validation for numeric fields in Angular2

Attempting to implement custom validation in Angular 2 has been a challenge for me. I have followed the necessary steps based on my understanding, but still struggling to get it working. import { FORM_DIRECTIVES, AbstractControl, ControlGroup ,FormBuilder ...

Is there a way to prevent the node modules folder from being uploaded when deploying a React app on Github Pages?

Struggling with the lengthy upload time of my React app on Github Pages. Every attempt to upload the node modules folder feels like an eternity due to its numerous dependencies. I've considered uploading just the build folder (minified version), but i ...

How to play two audio files at the same time on iOS Safari

I encountered a unique challenge in Javascript when attempting to play two audio files simultaneously on iOS Safari. One file is the voice script, while the other serves as background sound playing on loop. The code snippet I utilized for this task is as f ...

Disabling font-awesome checkboxes

As someone who is new to front-end technologies, I am trying to achieve the following. Despite my efforts to find a solution, I have not been successful so far. Here is the issue I am facing-- I have two master checkboxes labeled 1) I do not like numbers ...

What is the best way to align two navbar elements to the right in Bootstrap 5?

I've been attempting to position two elements at the end of the Bootstrap 5 navbar, but I haven't been successful. I've experimented with using ms-auto within a div that wraps around the login and sign up elements, but that hasn't work ...

Creating a dynamic HTML table by dynamically populating a column

I have limited experience with javascript, and I am working on a personal project that I enjoy. In the table below, you will find various location names along with their distances from the initial location. This serves as a travel companion for me to refe ...

"Top navigation element and anchors now have a permanent fix in place

Having some trouble with the CSS here - anchor links are getting hidden behind the navigation bar. Any ideas on how to fix this? Do you have a suggestion for making sure the anchor link text is visible just below the navigation bar? /* adjust the style a ...

Empty Media Viewer

I am encountering an issue with setting up a code, as it only displays a blank white page. Any suggestions on what might be causing this problem in the setup and assistance in resolving it would be greatly appreciated. <script type="text/javascript ...

Please refrain from refreshing the page multiple times in order to receive updated data from the database

Currently, I have created a countdown timer from 00:60 to 00:00. However, once the timer reaches 00:00, I am looking to refresh the page only once in order to retrieve a new value from the database. Does anyone have any suggestions on how to achieve this ...

incorrect application of margin and padding

Check out my HTML & CSS code. I'm facing an issue with the top padding, which should be 20px but is currently set at 10px. Here's a screenshot showing the problem. I've attempted to adjust margins and padding on different elements, but noth ...

Ensure that the nested div maintains its height consistently across all three columns

In my layout, I am trying to achieve uniform height for three columns, each containing the same sections like title and address. Not only do I want the cards to have the same height, but also the nested sections should maintain equal heights. For instance, ...

Communication breakdown between components in Angular is causing data to not be successfully transmitted

I've been attempting to transfer data between components using the @Input method. Strangely, there are no errors in the console, but the component I'm trying to pass the data from content to header, which is the Header component, isn't displ ...

Tips for achieving horizontal alignment of headers

My webpage has two headers positioned as 'CompanyName' on the top left and 'Date' at the top middle but I am struggling to align them horizontally. I attempted to enclose them inside a div element, however, this did not work. Can someon ...