Bootstrap: The search icon button within the input box breaks away from the input box on resolutions other than desktop

I am attempting to place a Search Icon Button inside the Search Input Box while using Bootstrap.

Although everything appears correctly at Desktop resolution, at non-desktop resolutions when the menu items collapse into a dropdown, the button and input box end up at opposite ends.

Here is an example of how it looks: http://prntscr.com/4m31c7

I have created a fiddle to demonstrate the issue: http://www.bootply.com/G7TudgkXPA

What can be done to ensure that the button and input box always stay together? Additionally, it is crucial that the Search Box remains centered; it cannot be positioned to the left or right.

Answer №1

What if we were to extend it to 100% width? This way, it would easily reach the adjacent element in both cases.

input#srch-term {
background: none;
border: 2px solid white;
border-top-left-radius: 1.5em;
border-bottom-left-radius: 1.5em;
width:100%
}

http://www.bootply.com/TzVC7Ww2fl#

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

Interacting between Angular controllers and directives while maintaining separation of concerns

In my AngularJS project, I've implemented a directive within a module named ThreeViewer that displays WebGL scenes based on the specified source file. The code snippet below outlines the basic functionality: angular.module('ThreeViewer', [] ...

Combining URLs in Angular 6 - A Step-by-Step Guide

How can I concatenate the commonUrl from CommonClass in Angular 6 for category.service.ts? common-class.ts export class CommonClass { constructor(public commonUrl : string = 'http://localhost:3000'){}; } category.service.ts import { CommonC ...

The alignment of the rectangle is being replaced

I'm attempting to center text and have it at a specific distance from the top of the webpage, but I'm encountering an issue. When I set the position to absolute, it seems to override the text-align: centered; property. I'm unable to move ...

Tips on positioning content beneath a fixed header or navigation bar when viewed in a web browser

Hi, I'm having an issue with creating a fixed header using HTML and CSS. When I set my header to be in a fixed position, it covers up the content below it. I want the content to be positioned under the header when the page is loaded. Additionally, I&a ...

What is the proper method for implementing an event listener exclusively for a left mouse click?

Is there a way to make Phaser recognize only left mouse clicks as click events, excluding right and middle clicks? Check out this Phaser example at the following link: https://phaser.io/examples/v2/basics/02-click-on-an-image. ...

Error in Next.js Image Component: Missing SRC

Encountering an error with the next.js image component, specifically related to a missing "src" property. Error: Image is missing required "src" property. Make sure you pass "src" in props to the `next/image` component. Received: {} Th ...

How to selectively load specific scripts in index.html with the use of angular.js

Let me address a problem I'm facing with a large development project. It seems that the current setup does not function properly on Internet Explorer. My idea is to only load files that are compatible and do not generate errors when accessed through I ...

Attempting to extract the data from SweetAlert

I've been attempting to retrieve the return value from sweetalert, but I encountered this: Promise {<pending>} >__proto_:Promise [[PromiseStatus]]: "resolved" [[PromiseValue]]:true resulting from this piece of code: var ret = swal({ ...

The onChange event does not function properly on formatted Mui sliders

Having an issue with the Mui styled Slider. The value is not changing smoothly and it seems like the thumb of the slider is not draggable. You can see the issue reproduced here. Thank you in advance. ...

What could be causing the data toggle feature in my navbar to not work on Bootstrap?

Here is a code snippet to create a simple collapsible navbar with Bootstrap 5 that includes a logout button. However, the data toggle feature for the logout button doesn't seem to work when clicked. Any suggestions on how to fix this? <!DOCTYPE ...

Leveraging environmental variables in a Vue.js web application

The article I recently came across discussed how to effectively utilize environment variables in vuejs. Following the instructions, I set up my local .env.local file and also installed dotenv. VUE_APP_AUTH_AUTHORITY = 'http://localhost/auth' I ...

The issue of `Console.log` displaying as undefined arises after subscribing to a provider in Ionic3

In the process of implementing the Spotify api into my Ionic 3 app, I encountered an issue where the data retrieved appears as undefined when attempting to log it. Let me share some code and delve deeper into the problem. Here is the function getData() tha ...

When inline elements are positioned right next to block elements

Can inline and block elements be placed on the same level without wrapping in HTML? Does it matter if they are wrapped or not? For example: <div class="name"> <span class="name__text">List name</span> </div> <div class="li ...

Using JQuery to access options dynamically generated within Select elements

I am currently working on Select elements that are dynamically updated with new options at set intervals. My goal is to programmatically access these new options in order to check if a certain value exists within the select element. I attempted to use the ...

Exploring the Differences: NodeJS and ExpressJS for Server-Side and Client-Side HTML Rendering

Embarking on my journey with Node.js, I find myself grappling with the concept of server-side and client-side HTML pages. My objective is to hone my skills by creating an e-commerce web store. The technology stack that I have set my sights on includes Node ...

Place an image in the middle of a div with text aligned to the right side

How do I center an image within a div that has text on the right side? The page layout is based on percentages and I want the image to be perfectly centered with the text floated to the right. This is what I currently have: IMG.logo { display: block ...

I desire the div to display based on the conditions set in the PHP file

Hi, I am looking to display the div with ID "msga" when a certain condition is met and show the div with ID "msgb" when another condition is met. Here is my PHP code: if(isset($_POST['aa'])) { echo "a"; } if (isset($_POST['bb']))) { ...

My webpage is struggling to locate the CSS stylesheet

Regarding the index file: <link rel="stylesheet" href="css/stylesheet.css"/> Everything seems to be working fine here. However, the rest of my html documents are located in a folder called "pages". I'm facing an issue where it can't loca ...

Is it feasible to retrieve and view local storage data within an Electron application?

I created an electron application that enables users to drag and drop elements like divs on the screen, saving their positions in localstorage as a class. The purpose is to ensure that any modifications made by the user persist even after reloading or re ...

Refreshing the settimeout function through a click event

I'm working on a feature where I use setTimeout to dynamically change the font size of paragraphs. My goal is to have the font size reset when the user clicks on the "reset" button or initiates the timer again. However, I've encountered an i ...