Ensure that the input box expands to occupy the entire HTML page

After reviewing numerous pages and questions related to this topic, I have located the correct solution but am struggling to implement it. My goal is to achieve a similar outcome to the second question, but I'm having difficulty figuring out how to do so. Style input element to fill remaining width of its container

The issue I'm encountering is that all the input elements only stretch as far as the end of the form section. I suspect that the problem lies with the form itself rather than the input boxes. How can I ensure that the form extends to the width of its parent? Below is the full code for reference.

<style>

div.modal-header{background-color: #1A2930; color: white; }
div.modal-footer{ background-color: #1A2930; color: white; }

div.modal-body{ background-color: #F0F0F0;  color: #0A1612; width: 100%; }
div.movement-modal-form{ width: 100%; }

label
{
float: left;
font-size: 20px
}
span{
display: block;
overflow: hidden;
width: 100%
}

input
{
background-color: #C5C1C0; 
border: solid 2px #0A1612;
color: black;
width: 100%;
height: 25px; 
font-size:12px; 
vertical-align:0px
}
textarea
{
background-color: #C5C1C0;
border: solid 2px #0A1612;
width : 100%
}

</style>

<div id="movement-modal" class="modal fade" role="dialog">
<div class="modal-dialog">
<div class="modal-content">

  <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal">&#x274C;  </button>
    <h4 id="modal-title" class="modal-title">{{#i18n}}inventory.modify.button.new-movement{{/i18n}}</h4>
  </div>

  <div class="modal-body">
    <form id="movement-modal-form"
    >
      {{>inventory/partials/movement-id-field-modal}}
      {{>inventory/partials/product-fields-modal}}
      <br/>
      <p>
      <!--This is #4--> 

            <label id="movement-lable"  for="movement-date">{{#i18n}}inventory.modify.table.movement-date{{/i18n}}</label>&nbsp;
            <input id="movement-date" class="movement-date" type="date" required>
      </p>
      <br/>
      <p>
      <!--This is #5-->
            <label for="store-from">{{#i18n}}inventory.modify.table.store-from{{/i18n}}</label>&nbsp;
            <br/>
            <br/>
            <select id="store-from" class="store-from"required>
                {{#inventoryStoreList}}
                    <option value={{ id }}>{{ name }}</option>
                {{/inventoryStoreList}}
        </select>
      </p>
      <br/>
      <p>

      <!--this is # 6-->
            <label for="store-from-current-quantity">{{#i18n}}inventory.movement.modal.store-from-current-quantity{{/i18n}}</label>&nbsp;
            <input id="store-from-current-quantity" class="store-from-current-quantity" type="text" disabled>
      </p>
      <br/>
      <p>

      <!--This is # 7-->
            <label for="store-to">{{#i18n}}inventory.modify.table.store-to{{/i18n}}</label>&nbsp;
            <select id="store-to" class="store-to" required>
                {{#inventoryStoreList}}
                    <option value={{ id }}>{{ name }}</option>
                {{/inventoryStoreList}}
            </select>
      </p>
      <br/>
      <p>
      <!--8-->
            <label for="store-to-current-quantity">{{#i18n}}inventory.movement.modal.store-to-current-quantity{{/i18n}}</label>&nbsp;
            <input id="store-to-current-quantity" class="product-current-quantity" type="text" disabled>
      </p>
      <br/>
      <p>
      <!--9-->
            <label for="movement-quantity">{{#i18n}}inventory.modify.table.quantity-requested{{/i18n}}</label>&nbsp;
            <input id="movement-quantity" class="movement-quantity" type="number" step="1" min="1" pattern="\d*" required>
      </p>
      <br/>
      <!--10 Notes-->
      {{>inventory/partials/note-field-modal}}
      <input type="submit" style="display: none">
    </form>
  </div>


  <div class="modal-footer">
    <button type="button" class="btn btn-danger" data-dismiss="modal" style="float: left">{{#i18n}}inventory.modify.button.cancel{{/i18n}}</button>
    <button id="movement-modal-submit" type="button" class="btn btn-success" style="float: right">{{#i18n}}inventory.movement.modal.button.save{{/i18n}}</button>
  </div>
</div>

Answer №1

It appears that the width of your modal-body is not behaving as expected. It seems like you are aiming to make the input match the width of the modal-body, but there may be some confusion in your question.

If you want the input to take up the full width of the modal-body, you can simply set the width of the movement-date class to 100%. This will ensure that the input element spans the entire width of its parent element, which in this case is the modal-body.


div.modal-body{
   background-color: white;
   color: black;
   margin: 20px 0;
   padding: 15px;
   width: 500px;
   overflow: hidden;
 }

 input.movement-date {
   background-color: lightgray; 
   border: solid 2px #6E6E6E;
   width: 100%;
   height: 25px; 
   font-size: 12px; 
   vertical-align: 0px;
}


<div class="modal-body">
    <form id="movement-modal-form">
      <p>
         <label id="movement-lable" for="movement-date"></label>
         <input id="movement-date" class="movement-date" type="date" required />
     </p>
   </form>
</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

Achieving an oval shape using HTML5 and CSS3: Step-by-step guide

<!DOCTYPE html> <head> <title> Oval shape</title> </head> <body> <div style="width:400px; height:400px; background-color:#ff0;">Oval</div> <p> Exploring the creation of an oval shape using HTML5 ...

The AngularJS directive is being triggered before the Jquery AJAX request is completed

I am currently facing an issue where the chart in my AngularJS application (using NVD3.org) is loading before the AJAX call completes and data is fetched. How can I ensure that the chart waits for the AJAX call to finish? <script> var dataxx= ...

Using vuetify's v-autocomplete component with the options to select all and clear items

I am trying to incorporate a "Filter by values" feature in my application similar to Excel or spreadsheets. However, I am facing difficulty with implementing the 'Select all' and 'Clear' button in v-autocomplete. <v-col> < ...

When using props.onChange(e.target.value) in a textField component in Material UI, it unexpectedly returns an object instead of a value

function FormInput(props) { const classes = formInputStyles(); return ( <div> <TextField onChange={(e) => props.onChange(e.target.value)} InputProps={{ classes, disableUnderline: true }} {...pro ...

Regular expressions won't produce a match if the string is empty

At present, I am employing the regular expression /^[a-zA-Z.+-. ']+$/ to ascertain the validity of incoming strings. If the incoming string is devoid of content or solely comprises whitespace characters, my objective is for the code to generate an er ...

Creating a JSON object from an array of data using TypeScript

This might not be the most popular question, but I'm asking for educational purposes... Here is my current setup: data = {COLUMN1: "DATA1", COLUMN2: "DATA2", COLUMN3: "DATA3", ..., COLUMNn: "DATAn"}; keyColumns = ["COLUMN2", "COLUMN5", "COLUMN9"]; ...

Which component from the Bootstrap library would be best suited for my needs?

I am looking to create a basic 6-page website. Here is the code for my main page: <html> <style> .ali{ width:170px; text-align:center; } footer{ background:#333; color:#eee; font-size:11px; padding-top: 25px; p ...

Challenge with dynamic parent routes

In my React application, different routes are loaded through various parent URLs. For example: {["/sat/", "/act/", "/gre/", "/gmat/", "/toefl/"].map((path) => ( <Route key={path} path={path ...

Is there a way for my React application to detect changes in an npm package?

I am currently customizing an npm package for my application, but I am facing issues with it not being detected when starting my development server. Previously, I was able to resolve this by removing the library and reinstalling it, followed by replacing t ...

Utilizing destructuring and Object.entries for advanced formatting

I'm embarking on a new React project and facing an issue with the JSON data structure returned by my API for meetings. I attempted to utilize destructuring and Object.entries. This is what I currently have: { "meetings": [ ...

Is there a way to retrieve the value from a select tag and pass it as a parameter to a JavaScript function?

I would like to pass parameters to a JavaScript function. The function will then display telephone numbers based on the provided parameters. <select> <option value="name-kate">Kate</option> <option value="name-john">John& ...

Tips for effectively utilizing "Session" in jQuery

Are there any comparable features in jQuery to Session["Param"] in C#? How can I implement it? I've looked up "sessionStorage" in jQuery, but I'm having trouble grasping it. ...

Leveraging JavaScript functions for invoking Ajax requests, accompanied by ASP.NET controls

Having a background in PHP, I am accustomed to using a PHP file to handle all of my ajax calls. Recently, I have been introduced to ASP.NET controls and the overall environment. I am curious about the correct method for handling ajax requests when they n ...

Try employing an alternative angular controller when working with the bootstrap modal

I am trying to implement a bootstrap modal in my main HTML file, and I need some help on how to call another Angular controller for the modal. The button that triggers the modal is within a div that already has an Angular controller, and this is causing th ...

Tell me the permissions that a user possesses in discord.js

I need help creating a command using Discord.js that can display a user's permissions. For instance, the command could be $permissions @user and it should output something like: "User permissions within this guild: " I'm unsure if ...

CSS - What's the source of this mysterious whitespace?

I'm currently making adjustments to a Wordpress website that is designed to be responsive. The site uses media queries to adapt its display based on the user's screen size, and everything looks great except for when the screen width is at its sma ...

Changed over to a promise-oriented database, causing my login feature to malfunction completely

Although I can successfully register, when I am redirected to my game route, all I see is a blank Error page with [object Object] on the screen. This message also appears in my console periodically. Initially, I suspected an issue related to socket.io, bu ...

Retrieve data from a text file using ajax and then return the string to an HTML document

Just starting out with ajax, I have a text file containing number values For example, in ids.txt, 12345 maps to 54321 12345,54321 23456,65432 34567,76543 45678,87654 56789,98765 Here is the Html code snippet I am using <html><body> < ...

Problem with HTML relative paths when linking script sources

Having trouble with a website I constructed using Angular. The problem lies in the references to javascript files in index.html. The issue is that the paths in the HTML are relative to the file, but the browser is searching for the files in the root direct ...

What could be causing my AJAX code to fail in retrieving information from an API?

Hey everyone, I'm new here and hoping to get some help with an issue I'm facing. I've written a code to fetch data from an API and display it on my HTML page, but for some reason the AJAX code isn't working. There's nothing showing ...