label positioned above every button in the button group

I'm trying to organize buttons using btn-toolbar (not using btn-group because I want different buttons) and also want to add a label at the top of each button. However, I am having trouble achieving my desired result. Here is the snippet of code I have:

<div class="btn-toolbar" role="toolbar" aria-label="Toolbar with button groups">
  <button type="button" class="btn btn-lg output_border">A</button>
  <button type="button" class="btn btn-lg output_border">A</button>
  <button type="button" class="btn btn-lg output_border">A</button>
  <button type="button" class="btn btn-lg output_border">A</button>
  <button type="button" class="btn btn-lg output_border">A</button>
  <button type="button" class="btn btn-lg output_border">A</button>
</div>

Here is a picture showing what I am expecting

Answer №1

Here is a custom solution tailored to your specific needs, designed based on the image you provided:

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Custom Button Toolbar</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
  <style>
    .labelarrange1{
        float:left;
        position:relative;
        left:5px;
        top:8px;
        font-size:10px;
    }

    .btn{
        border-radius:0;
        background:powderblue;
        border-radius:0;
    }
  </style>
</head>
<body>

<div class="btn-toolbar container" role="toolbar" aria-label="Toolbar with button groups">
  <div class="row">
      <div class="col-md-1">
          <label class="labelarrange1">Relay 1</label>
          <br>
          <button type="button" class="btn btn-lg">A</button>
      </div>

      <div class="col-md-1">
          <label class="labelarrange1">Relay 2</label>
          <br>
          <button type="button" class="btn btn-lg">B</button>
      </div>

      <div class="col-md-1">
          <label class="labelarrange1">Relay 3</label>
          <br>
          <button type="button" class="btn btn-lg" style="background:#eee;">O</button>
      </div>
  </div>



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

Answer №2

here is a helpful tip


<div class="btn-toolbar" role="toolbar" aria-label="Toolbar with button groups">
  <label>b</label>
  <button type="button" class="btn btn-lg output_border">B</button>
  <label>b</label>
  <button type="button" class="btn btn-lg output_border">B</button>
  <label>c</label>
  <button type="button" class="btn btn-lg output_border">C</button>
  <label>d</label>
  <button type="button" class="btn btn-lg output_border">D</button>
  <label>e</label>
  <button type="button" class="btn btn-lg output_border">E</button>
  <label>f</label>
  <button type="button" class="btn btn-lg output_border">F</button>
</div>

it's important to keep things organized for better clarity.

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

I am encountering an issue with Angular where the following error message is displayed: "src/app/app.component.html:18:20 - error TS2339: Property 'DepScreen' does not exist on type 'AppComponent'"

This code snippet is from my app.component.html file: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0" ...

Confirm Submission Issue in HTML Form

During my testing of the blacklist confirmation dialog, I encountered an issue where clicking the OK button did not submit the form as expected. Instead, it seemed to be stuck in a loop where clicking the button had no effect and the dialog remained on scr ...

Guide on incorporating CSS into a JavaScript function

Currently, I am utilizing a jQuery monthly calendar where each day is represented by a cell. When I click on a cell, I can trigger an alert message. However, I also want to modify the background color of the specific cell that was clicked. Unfortunately, ...

Retrieve the input value closest to the selected row

I need to extract the price and currency value of a checked row containing a checkbox. The price is specified in a text box while the currency is selected from a dropdown menu. $(document).ready(function() { $('#test').click(function(){ ...

Event Listener for Spelling Quiz Buttons: Check Correct and Incorrect Answers

I am currently in the process of developing a spelling quiz for a project website using HTML, CSS, and JavaScript. The idea is to present the user with a word that has two missing letters indicated by underscores. The user then selects the correct answer ...

What is the best way to include some white space around a paragraph?

Can anyone help me figure out how to add margins to my paragraphs with borders on a website? I've tried using margin in CSS, but it's not working. Here is the HTML code I am using: body{ margin:0px; font-family:Calibri; background ...

What could be the reason for the active class not being triggered by Bootstrap?

After making an Ajax call to a PHP file from jQuery, I am trying to loop through the information and format it within table rows and cells. Specifically, I want to use the <tr class="active"> class and the <tr><td> structure provided by B ...

Tips for identifying modifications in an input text field and activating the save button

Currently, I am developing a function that can detect any changes made in the text field and then activate the save button accordingly. This code is being executed in Visual Studio 2017, using HTML and JavaScript. (function () { var customer_addres ...

Retrieve information from HTML elements

I am looking to extract the paragraph content surrounded by HTML tags using Python. &lt;p style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-size: small; font-family: lato, arial, helvetica, sans-serif;&quot;& ...

Extract the HTML field value from an AJAX drop-down selection, rather than relying on user input

I have a field that allows users to select from a dropdown list using the following code: $(function() { $('.serial_number').live('focus.autocomplete', function() { $(this).autocomplete("/admi ...

Repositioning a jQuery function from inside a plugin

I need assistance with customizing the functionality of a jQuery plugin called AjaxFileUpload. You can find the plugin here: https://github.com/davgothic/AjaxFileUpload The current behavior of the plugin is that it uploads the file as soon as it is select ...

Creating form components in a row

I'm currently working on an app and I'm attempting to align 3 form elements in a ratio of 25/25/50, but it's proving to be quite challenging. At the end of this message, you'll find a picture showing the current layout. Additionally, I& ...

Can ngFor be utilized within select elements in Angular?

I'm facing an interesting challenge where I need to display multiple select tags with multiple options each, resulting in a data structure that consists of an array of arrays of objects. <div class="form-group row" *ngIf="myData"> <selec ...

Positioning Alignment for a CSS Layout with Two Columns

I am trying to achieve a specific layout using CSS. I want the signature to align with the bottom of the other boxes in the design. The challenge is that either box can have different amounts of content, and the signature should always align with the lowes ...

Using a form tag within a table in HTML5

Can someone help me figure out how to integrate a form with the "Get" method into a table? The table includes a text field, and upon submitting the form, it should initiate validation. The validation process currently works correctly, however, when submi ...

The imported font used in Firefox is displaying with a striking underline text-decoration

I am currently using the Cardiff font in a project and attempting to apply the style text-decoration:underline to it. While this works perfectly in Chrome (Version 35.0.1916.114), in Firefox (Version. 29.0.1) the underline appears to be crossing through t ...

In Android Kitkat 4.4.4, the Ionic navbar displays icons vertically when using the <ion-buttons end> feature

When viewing in the browser with ionic serve, everything looks fine. However, on an Android Kitkat device running version 4.4.4, the buttons on the right side of the navbar are displaying vertically instead of horizontally. <ion-navbar> <ion-ti ...

AngularJS call to the web service

I am facing an issue where I do not receive any response upon clicking the button. <!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.27/angular.min.js"></script> <sc ...

Difficulty in implementing a radio button selection form using Django and Bootstrap styles

Currently, I am facing an issue while trying to develop a form with radio button choices using Django. The website is based on Bootstrap 4 theme and encountering a problem where the buttons disappear upon applying the custom-control-input class. I initial ...

What are some methods for simulating user interaction on input and button elements?

Here is a code snippet available in this stackblitz demo. Essentially, there is a basic form with an input field and a button. Clicking the button will copy the current value of the input to a label: https://i.stack.imgur.com/pw3en.png after click: htt ...