Adjust the size of the input form

Trying to create this design:
https://i.sstatic.net/rPSiN.png

But currently stuck with this layout:
https://i.sstatic.net/3k5bE.png

I'm puzzled on how to resize the input field with an icon on the right while using col-md-12... Check out my code below:

.form {
  margin-top: 8px;
  margin-left: 13px;
  display: flex;
  flex-direction: row;
}

.search-field {
  padding: 10px 35px 10px 15px;
  color: #fff;
  border-color: #d4e0e0;
  border-radius: 15px;
  outline: none;
  background: #FFFFFF 0% 0% no-repeat padding-box;
  box-shadow: inset 0px 3px 6px #0000000D;
  border: 1px solid #D4E0E0;
  width: auto;
  color: #000;
}

.search-button {
  z-index: 1;
  float: inline-end;
  background: transparent;
  border: none;
  outline: none;
  margin-top: -2px;
  margin-left: -45px;
}

.search-button img {
  width: 20px;
  height: 20px;
  object-fit: cover;
}
    <div class="container">
      <div class="list row">
        <span class="font-link-bold" style={{ fontSize: "26px" }}>
          <span class="title-card font-link-blue-bold">Mes </span>Conseils
        </span>
        <div class="button-create">
          <IconCreate />  Créer un nouveau conseil
        </div>
        <br />
        <br />
        <span
          class="font-link"
          style={{ fontSize: "16px", color: "#657273" }}
        >
          Saisir vos mots-clés ou coller un texte :
        </span>
      </div>

      <div class="row">
        <div class="col-md-12">
          <form action="/" method="GET" class="form">
            <input
              type="search"
              placeholder="Search"
              class="search-field"
            />
            <button type="submit" class="search-button">
              <img src={IconLoupe} alt="" />
            </button>
          </form>
        </div>
      </div>
     </div>

The issue in my html is that when I use "col-md-12", it takes up all the space... only the input field occupies a smaller part like col-md-3 or 6...

Answer №1

To solve the issue, consider setting the width of .search-field to 100%

.search-field {
  width: 100% !important;
}

Alternatively, you could also assign a position value to your icon elements

parent{ 
  position: relative;
}
child{ 
  position: absolute;
  top: 5px;
  right: 20px;
}

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

Tips for stopping variables from leaking in JavaScript

I'm currently working on a JavaScript code for my task manager website. Each page has its own JS file, but I've noticed that the data saved in one file seems to leak over to the others. How can I contain these variables so that tasks don't s ...

Customize the appearance of a <label> tag when it is inside an <input> tag that is marked as invalid

In an ideal scenario, I wish for the text on a label to change color when the input value is considered invalid. For instance: <form> <label> Enter your name: <input type="text"> </label> </form> Ideall ...

Looking for a regular expression to require either a dollar sign ($) or a percentage symbol (%) but not

At the moment, I currently have this input field set up on an HTML page within my Angular 9 application: <input type="text" formControlName="amountToWithholdInput" onkeyup="this.value = this.value.replace(/[^0-9.%$]/, &ap ...

Generate a JSON array containing objects consisting of a combination of string and boolean values

My goal is to generate a list containing objects with names and boolean values by utilizing AJAX. This process is initiated in the following manner: $('.si-accordion').click(function () { $(this).siblings('.accordion_tab&apo ...

Attempting to implement bootstrap pagination using PHP mysqli

Hi there, I'm currently working on implementing a pagination feature using Bootstrap. My goal is to display all results from mySQL data while limiting the data to 10 entries per page. I would appreciate any assistance with this. Here's the code I ...

Using HTML and JavaScript to verify email addresses

I have been working on an "Email Validation" code, but it seems to be malfunctioning. I can't figure out why. Would you mind taking a look at it? Thank you. I suspect that the issue lies with this line document.getElementById("custEmail").onchange = ...

Tips for including space at the beginning and end of a dynamically created table cell

My table is dynamically generated with contents drawn from a database, creating rows based on the data. Each cell has a rounded border and 2px padding for consistency. I want all cells to appear evenly spaced and padded vertically, but I'm facing an ...

Differences between React class properties and ES6 class properties

With React 16.2, defining class properties is done differently with the tagLine example shown below: class Header extends React.Component { tagLine = "Super Hero"; render() { .... } } Contrastingly, in ES6 classes, it's not possible to define ...

Passing index value using navigateByUrl method

I have developed a home component and a view component to display different levels of employee details. The home component presents basic information, while the view component shows comprehensive details. The code in my home.component.html file looks like ...

What could be causing the EBUSY: resource busy or locked, open errno: -4082 error to appear while trying to build storybook 7 in next.js 13?

While attempting to create a storybook, I encountered the following error in my project: [Error: EBUSY: resource busy or locked, open 'C:\Users\ali\Desktop\Works\Design Systems\projects\storybook-test2\node_modu ...

Customize markers in React Leaflet to display different icons for all markers except the active one

I'm currently working on implementing an active marker that stands out from the other non-active markers. Here is what I have in mind: https://i.stack.imgur.com/zaBsU.png To display all of these icons within the map, I am using the code snippet bel ...

Babel refuses to compile a file if it detects the presence of a nested package.json file within it

Currently, I am utilizing WebPack, Babel, and React within my project. The folder structure that I have in place is outlined below: node_modules/ .babelrc package.json SomeThirdPartyFolder/ node_modules/ package.json src/ FileA.js ...

Bootstrap 4 - positioning link element to align with heading in card header

I'm currently utilizing Bootstrap 4+ to design a card that features a collapsible card-body, triggered by a link located in the card-header. <div class="card text-left mb-3 mt-3"> <div class="card-header p-3"> <h4>Where should ...

Is it advisable to utilize TypeScript interfaces for declaration files and React component prop definitions?

Whenever I create structures for object types, my go-to method is to define them in my declaration.d.ts file like this: type TagsObject = { _id: string; tag: string; } type ProjectData = { _createdAt: string; _id: string; _rev: string; _type: ...

Revamping repetitive JavaScript code for the pagination of Instagram Stories

I'm currently developing a website that utilizes fullpage.js and includes a section with multiple slides. These slides automatically transition every 10 seconds. I wanted to implement progress bars similar to those on Instagram, where each bar fills ...

When an option is selected, the CSS class associated with that option is removed

<select class="FunctieSelect"> <option class="yellow" value="-1">- kies -</option> <option class="yellow" value="1">KSZ functie</option> <option class="yellow" value="2">Bakker</option> <option class="yellow" va ...

Ways to prevent the jQuery simple slider from transitioning slides while it is in an invisible state

There is a jQuery slider on my website that behaves strangely when I navigate away from the Chrome browser and return later. It seems to speed through all pending slides quickly when it was not visible. Now, I want the slider to pause when it becomes invi ...

Tips for altering the color of spans that share a common top position without affecting the surrounding sibling elements above or below

Is there a way to change the color of spans with the same top position, excluding sibling elements above or below, in a paragraph made up of spans? I've been working on how to change the color of the line of span tags that contain another span with t ...

Utilizing Draft JS to dynamically insert text in the form of span

I'm utilizing Draft.js with its mentions plugin. Occasionally, I'd like users to input a mention not by choosing from a dropdown menu, but by typing something like, for example, "@item" or "@item". In the function below, you can observe that if ...

Utilizing dynamic URLs to transfer query parameters between pages

I need to include an additional parameter when navigating to a different page. I attempted the following with ?extraParam=[data.buildingName] but it is not functioning as expected. <Link href="/accounts/[accountId]/buildings/[buildingId]/gateways/[ga ...