Adjusting the standard width of a search bar

Just beginning to explore the world of bootstrap and I'm facing an issue with adjusting the width of a search box. It is currently too close to the picture above and my navigation bar below in the container, making it look unattractive. Using &nbsp has created an unsightly large gap. Below you will find the snippets of CSS & HTML that I am working with. Any guidance on how to resolve this would be greatly appreciated.

.form-inline .form-control {
  display: inline-block;
  width: auto;
  vertical-align: middle
}

.form-inline .form-control-plaintext {
  display: inline-block
}

.form-inline .input-group {
  width: auto
}

.form-inline .form-check {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  -webkit-box-pack: center;
  -ms-flex-pack: center;
  justify-content: center;
  width: auto;
  padding-left: 0
}

.form-inline .form-check-input {
  position: relative;
  margin-top: 0;
  margin-right: .25rem;
  margin-left: 0
}

.form-inline .custom-control {
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  -webkit-box-pack: center;
  -ms-flex-pack: center;
  justify-content: center
}

.form-inline .custom-control-label {
  margin-bottom: 0
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<!-- Search -->
<form class="form-inline ">
  <input class="form-control mr-sm-2 " type="search" placeholder="I'M LOOKING FOR..." aria-label="Search">
  <button class="btn btn-pnpsample my-2 my-sm-0 " type="submit">Search</button>
</form>
<!-- End search -->

Answer №1

here's a suggestion: HTML

<div class="searchcont">
    <form class="form-inline ">
      <input class="form-control mr-sm-2 " type="search" placeholder="FIND WHAT YOU NEED..." aria-label="Search">
      <button class="btn btn-find my-2 my-sm-0 " type="submit">Search</button>
    </form>
</div>

CSS

.searchcont{margin-top: 50px;}

Answer №2

If you need to increase the width of the form element, simply adjust the width property in your CSS code like this:

form {
    width: 500px;
}

As for the whitespace issue around the image, it's difficult to pinpoint without more context from your markup. Make sure to provide additional details for a proper assessment.

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

What sets npm node-sass apart from npm sass?

Recently, I discovered that the recommended approach is to utilize @use rather than @import in sass. However, it appears that using npm sass instead of npm node-sass is necessary for this. Can you clarify the distinction between these two? Also, why do @ ...

Are there any alternative methods to refresh the Google Search Result for my website? (Meta tags are ineffective)

I'm facing an issue with the Google search result of my website where it's displaying old text instead of what I intended. I've tried using meta tags like nosnippet and description, but the problem persists. Can anyone suggest resources or ...

Display data from additional tables within a loop

Within my database, I have organized information into 3 tables: train_information: +----------+-----------------+------------------+ | train_id | number_of_axles | number_of_bogies | +----------+-----------------+------------------+ | 1 | ...

Display the scrollbar within a flexitem by utilizing flexbox styling

I am currently setting up my HTML website with Bootstrap flex and I have a specific layout in mind. I want the inner div to have scrollbars while the outer div fills up the rest of the page. Take a look at this example: <div class="d-flex align-items- ...

Is it possible to retrieve JavaScript object properties using HTML elements?

I have fetched an array of objects using jQuery.getJSON(). Each object should be represented by an HTML div element, allowing users to click on the element and access all properties of the corresponding object. What is the most efficient approach for achie ...

Connecting to an element within a separate node (XSLT)

I have an XML document that includes a list of companies. My goal is to use XSLT to create links that point to the <link> child of the next company node. To provide a clearer picture, here is a snippet of sample XML data I am working with: <portf ...

Encountering issues with integrating Sass into Angular 4

Hi there! I recently started a new project in Angular 4 and encountered some issues with the Sass styling. Every time I try to add sass and run the project, I keep getting this error message: body{ h1{ color : red; } } ^ Invalid ...

How to create a captivating image effect using CSS on hover

I am attempting to create an animated image on hover. The desired outcome is similar to the one showcased here: Check it out (scroll to view the image "Our Team") Essentially, I want a background where I can showcase information such as names and links ju ...

Images loaded from Firebase are only showing as text in the RecyclerView fragment, rather than displaying as actual images

My images from Firebase are not appearing in the image view, although the name of an image is visible in the text view above the recycler view. Here's my code that I'm struggling with. package com.example.bbeast.HomeActivity; import android.n ...

How can I prevent further input in an input field after making a selection from mat autocomplete in angular?

Hello everyone, I am looking to disable the input field after selecting a value from the drop-down. Additionally, I want to be able to reset the selected value using a reset button. If you need a reference, you can check out Stackblitz: https://stackblitz ...

What is the best way to place a search icon beside my label?

Hello there! I am currently working on designing in Angular 4 using bootstrap 4. I attempted to include a search icon at the end of my label. The code is as follows: <div class="row "> <div class="form-group col-lg-2"></div> <div ...

Is there a delay when dynamically filling out an input field in a form with the help of the jquery .keypress() function?

I have a form that I want to populate dynamically with the values from another form. It's almost working as intended, but there seems to be a delay of some sort. For example, if I enter "ABCDE" in field1, field2 will only populate with "ABCD". It ne ...

What is the method for showcasing an image stored in a Mysql database as a Medium Blob on my webpage?

After following instructions from the internet, I have implemented the following code in my HTML: <img src="imagescript.php?id=1"> Additionally, the imagescript.php file contains the following PHP code: <?php $servername="loc ...

Listening to a variety of MP3 files

Last weekend, my dad asked me to transfer a few CDs to his digital library so he can listen to them anywhere. I was thinking of hosting the MP3 files on my server and creating a script that displays all the music files. He could then select one or multiple ...

Evaluating CSS Specificity

Is there a recommended approach for automatically testing css selectors? I am in the process of developing a SCSS framework and I want to integrate automated tests. Specifically, I aim to verify that the css selectors are functioning correctly. For examp ...

Exploring the functionalities of Ajax and HTML5 history states in relation to back button behavior

There have been numerous inquiries regarding the functionality of pushState in HTML5, but I'm encountering two specific issues for which I haven't found any solutions. My popstate handler is defined as follows: $(window).bind('popstate&apos ...

An easy way to insert a horizontal line between your text

Currently, I have two text responses from my backend and I'm considering how to format them as shown in the design below. Is it possible to automatically add a horizontal line to separate the texts if there are two or more broadcasts instead of displa ...

CSS Grid generates a unique container for every HTML element

My website's CSS code includes the following: *{ height: 100%; width: 100%; margin: 0; } .grid{ display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; } .grid div:nth-child(odd){ border: black 2px so ...

How can JavaScript be used to automatically send a user to a designated page based on a selected option in

I am in the process of creating a JavaScript function that redirects users based on their selection from a dropdown menu. Additionally, I need to ensure that the word "admin" is set for both the username and password fields. view image here function my ...

Attempting to remove a specific row from a table by targeting the value of a cell with Jquery

I need help with deleting specific rows in a table using jQuery. Each row has a checkbox as its first cell, and I want to delete only the rows that have their checkboxes checked when I click the delete button. The code snippet below is what I have been att ...