What is the best way to align a button in the center of the same line?

I am trying to place a button in the center of a row, while having text aligned to the left on the same line:

<div class="col-xs-1">
    <div class="card-header">
        <h4 class="card-title">set</h4>
    </div>

    <div class="text-center"> 
        <button type="button" class="btn btn-primary center-block add-option" id="add-option">test</button>
    </div> 
</div>  

However, I am facing an issue and the result is not as expected: https://jsfiddle.net/DTcHh/96757/

Answer №1

Bootstrap offers a wide range of classes for customization.

Here is one potential solution:

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css">

<div class="container-fluid card-header btn-group">
  <h4 class="card-title">set</h4>
  <div class="text-center container">
    <button type="button" class="btn btn-primary center-block add-option" id="add-option">test</button>
  </div>
</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

Problems with pagination in jQuery DataTables

Utilizing the most recent version of jQuery's DataTables. Facing an issue where the pagination at the bottom of my data table is overlapping with my bottom div container. Unable to figure out the cause and solution for this problem. Can anyone provid ...

Having an issue with Javascript onclick not updating div content upon first click

Having difficulty getting content from one div to another on the initial click. Some of my code: <a href="#" onClick="goPage1();">Feed</a> Function being called: function goPage1(){ $("#feed").html(""); get_jsonp_feed(); $("#con ...

Is there a way to include colored margins in Bootstrap 4?

How can I implement a colored margin in Bootstrap 4? ...

Search for the specified pattern in BBEdit and delete the entire table that matches

While I am not an expert, I recently acquired BBEdit for a specific project. My current task involves working on an HTML file that contains numerous entries I need to eliminate. Specifically, I want to remove all tables that contain the text "NOT CONVERTE ...

Customize Joomla content in a component by using CSS within a template that I personally designed

Is there a way to customize the text content of a component in Joomla by editing the body text? The CSS properties for #content are adjusting padding, margin, border, width, height, and background but not affecting font attributes... Inside index.php < ...

Building a collapsible navigation menu with dropdown options using Twitter Bootstrap 3

I am struggling to replicate the functionality of the user menu found in this template. Here is a link to the template: (I have purchased the code but I am specifically looking into getting the user-menu feature to work correctly.) On mobile devices, when ...

The CSS rule for @media screen is failing to function properly on mobile devices

Is there a way to hide a specific section of my home page only on smartphones? I've tried using the code below but it's still showing up on my phone. Any advice? @media screen and (max-width: 640px) { #statistics .row { visi ...

Looking for a way to locate the final child of a specific type (in this case, a table)

Consider the following nested structure: <div id="main"> <table> <tbody> <tr> <td> <div> <table> <tbody> ...

Occasionally, the letters in Google Fonts get jumbled up when refreshing the page, but

During our development process on localhost, we've come across a peculiar issue with Google Fonts. Every now and then, when refreshing the page, the letters in the text become jumbled up. This seems to happen randomly, about once every 5 refreshes. Th ...

Preserve page configurations upon page refresh

I'm currently in the process of creating a 'user settings' form. Each list item represents a different section, such as Updating username, Updating email, and Changing password. It looks something like this: <li> <header>Ti ...

Laravel Conflicting Scripts, Bootstrap clashing issues

Currently working on a Laravel project, I'm trying to integrate both Bootstrap and MDBootstrap. However, I keep encountering the error TypeError: $(...).DataTable is not a function. After some online research, it seems like this issue is usually cause ...

Steps for selecting a checkbox via a link or button

Looking to revamp my quote builder by replacing small checkboxes with stylish 'SELECT' buttons that can automatically check the corresponding checkbox. I also want to apply a specific class to the parent div when the checkbox is checked, allowin ...

Illustrative Python Django email submission form demo

I am currently working on creating a contact form for my website, but I am struggling to find examples using Django. While PHP email forms are readily available, I don't have the knowledge to create one from scratch using Django. Is there anyone who c ...

Insider's guide to showcasing code in vibrant colors using Python Django

Context: I am currently working on a Python Django web application and need to showcase code snippets in the browser with syntax highlighting. An example of the code snippet I want to display would be: if True: print("Hello World") I am look ...

"Problem encountered when using Window.print() in Chrome on an iPad while displaying in a pop-up window created using

My code works perfectly in all browsers and operating systems, except for iPad Chrome. Can anyone help me troubleshoot this issue? <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, ...

I don't understand why my BeautifulSoup code is throwing an attribute error even though the variable it's referring to is assigned a value

Currently, I am working with Python 3.9.1 along with selenium and BeautifulSoup to develop my first web scraper targeting Tesco's website. This is essentially a mini project that serves the purpose of helping me learn. However, upon running the code p ...

Chrome mobile's justify-content for space-evenly is malfunctioning

Experiencing an issue with the space-evenly value for justify-content on Chrome mobile, while it functions correctly on Desktop and Firefox mobile. A minimal example can be seen here: Example Having a flex container in a row direction aiming to evenly sp ...

"Integrating JavaScript files into HTML using Flask: A step-by-step guide

I have created an HTML page with a JavaScript section where I am importing various other .js files: <script type="module"> import * as THREE from "../build/three.module.js"; import { OrbitControls } from ...

Exploring the application of AJAX value within inline HTML using JINJA

My flask server responds to an AJAX call with data, which I then display dynamically in my html using the ids of the elements. Now, I want to take it a step further and change the color of the html component based on the value returned. I attempted to us ...

jQuery fails to recognize response

Can anyone figure out why my alert isn't functioning correctly? <script type="text/javascript"> function SubmitForm(method) { var login = document.form.login.value; var password = document.form.password.value; ...