The width of the Bootstrap input-group-btn is stretched too far, causing everything to appear misaligned

I'm experiencing difficulty with bootstrap's input groups. When the window size is larger, the 'input-group-btn' class keeps expanding in width, causing the search bar to become off-center. I've attempted setting a max width on that element, but it didn't resolve the issue. I also tried floating the elements and placing them in a row with columns, but nothing has been successful for me.

Using btn-group-justified fills up the space, but it's not exactly what I'm aiming for.

Here is a link to a code example

I can't upload images here, so you can view one by clicking this link.

html,
body {
  height: 100%;
  background-color: #666699;
}
.well {
  background-color: #ffffee
}
#content {
  padding: 25% 25% 5%;
}
.search-form {
  border-radius: 30px 0 0 30px;
}
.input-group {
  width: 100%;
}
span.input-group-btn {
  max-width: 38px;
}
#search {
  border: 1px;
}
.search-btn {
  cursor: pointer;
  border-radius: 0 30px 30px 0;
  background-color: #fff;
  color: #669;
}
.text-center {
  color: #fff;
}
<body>
  <div class="container">
    <div id="content">
      <form class='form-inline'>
        <div class="input-group">
          <input type='text' id='search' class="form-control search-form" placeholder="Scooby Doo">
          <span class="input-group-btn">
              <button id="search-this"type="button" class="btn btn-default search-btn">
                  <i class="fa fa-search"></i>
              </button>
            </span>
        </div>
      </form>

      <p class="text-center">Some centered text</p>


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

Answer №1

Success! Here's my solution:

  • Changed the span inline style to width:39px
  • Appended the 'pull-right' class to the button element

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

Raise the image above the wrapping div, positioning it at the very bottom

I'm struggling to position an image within a div in a way where: it protrudes above the div it begins at the very bottom of the div (with a small gap that I can't eliminate) Below is the relevant HTML code snippet: <div class="teaser-imag ...

Could really use some help with troubleshooting my jQuery UI Todo List - it's just not

I've been working on a new project using jQuery UI to create a "to do list" application. So far, I've managed to get it up and running, but I'm having trouble displaying the tasks correctly in the designated div. Instead of showing up as a b ...

The anchor for the circular image is oversized

Currently, I have a PHP code that displays a user's profile picture, and when clicked, it takes them to their own profile. The image is displayed correctly, and the link works fine. However, there seems to be an issue with the area covered by the anch ...

The configuration file for custom paging slider in react.js is nowhere to be found

I am trying to implement a custom paging slider based on the tutorial at . I followed the instructions and installed the necessary packages. However, when I attempt to run the code, I encounter the following error: ./src/Carousel.js Module not found: Can& ...

When attempting to open the HTML file through an Express application, the background image specified by `background-image: url()` may

Upon opening the html file by directly clicking on it, the background-image styled with url() functions correctly. However, when I open this file within an express app using res.sendFile(), the background-image fails to display. Interestingly, all other CS ...

Is there a way to deactivate the Bootstrap DatePicker?

I have been attempting to disable the Bootstrap Date picker by using the attribute disable="true". The text-box is now disabled, but the date picker still opens when clicking on the text-box. How can I resolve this issue? HTML <div class="input-group" ...

Opacity filter malfunctioning

It seems that the filter: opacity property is not functioning as expected in IE8. Despite having used it successfully before, I am currently facing issues with its implementation. Strangely enough, Firebug does not display the filter rule at all; only norm ...

Using media queries in JavaScript

I've been trying to figure out how to format these parameters: @media screen and (-webkit-min-device-pixel-ratio: 1.3), (min-resolution: 124.8dpi), (max-device-width: 550px) My goal is to create an if statement using the values above, structured lik ...

How can you locate and emphasize specific text within various elements using JavaScript?

Created a script to highlight linked text in another HTML page. <p>Click <span class="f1"><a href="#myModal" data-reveal-id="myModal">here</a>/span></p> <div class="leftspread"> <p class="table-caption"& ...

div within a fixed width container with 100% width inside

Is there a way to ensure that div B has a width of 100% when nested inside Div A, which already has a fixed width? .divA{width:600px; margin:0 auto;} .divB{width:100%; height:20px; background-color:black} .filler{height:800px; background-color:grey} ...

Transform this background into a transparent one, then ensure it becomes visible and remains that way

Here's what I've been working on: My HTML code: <div id="smith"> <img class="top" src="http://i.imgur.com/D6Kohra.png"/> </div> And the CSS for it: #smith { background: url("http://i.imgur.com/1ABXZ1y.png") no-repeat ...

CSS smoothly scrolls upward within a set height restriction

Is there a way to use CSS to ensure that the scroll bar of a fixed-height message box is always at the bottom, displaying the latest entry? Currently, as more messages populate the chat box main section, everything inside remains static. The only way to v ...

Switching from a layout of 3 columns to 2 columns on iPad when orientation is changed to portrait

Apologies for posting this inquiry here, but I am facing a challenge with an iPad issue when switching to portrait orientation on my website. I am using a @media query to detect the portrait view and I want to switch from three columns to two. However, th ...

Adjusting the panel dimensions based on the screen size

One feature on my website is a sliding panel (Image 1) located on the right side. It appears and disappears when a button is clicked, covering the entire height of the screen.https://i.sstatic.net/dF5Zc.jpg Here's the CSS code for this sliding panel- ...

Tick the checkbox to indicate that I want to insert an image in the adjacent column for the same row

Every time I click on the checkbox, an image should appear in the adjacent column for that specific row. Despite using the addClass() method and targeting the td, the image is appearing in all rows instead of just the selected one. Could somebody help me ...

Grunt is unable to handle the lesscss file

I'm in the process of combining a group of .less files into one large .less file, and then converting it into a single .css file using Grunt's grunt-contrib-less module. module.exports = function(grunt) { require('load-grunt-tasks&apos ...

Achieve a scrolling effect for just a specific section of an HTML page

Hey there! I'm currently working on adding scrolling text along the side of a webpage for a specific section. My goal is to have three different sections, each with text that stops scrolling when you reach it and then transitions to the next section o ...

Scrolling horizontally with scrollbar functionality

My goal is to create a webpage with a horizontally scrollable DIV element in the center, where the scrollbar appears only at the bottom of the DIV, not at the bottom of the entire page. I am wondering if it is possible to have a scrollbar placed at the ve ...

What could be causing my links to not appear in Internet Explorer 9?

Why are my links not showing up properly in Internet Explorer 9? If you prefer not to visit the website, you can directly access the style sheet at... This issue is specific to IE 9 and does not occur in other versions of Internet Explorer. ...

Hero images of the highest quality can become unclear as they are reduced in size

I've been investigating an issue with the full-width hero images on my Wordpress site that appear blurry on certain mobile devices, particularly at smaller sizes. The images in question are 1920 x 1080 pixels. When viewing the images between a width ...