Position the vertical bar directly adjacent to the form input field

Looking for assistance with creating a unique webpage layout that includes a form where the employee ID is visually separated from the rest of the content by a vertical bar extending across the entire page. However, my attempts to achieve this using a green vertical bar have resulted in unexpected outcomes. Any support or guidance would be greatly appreciated!

.vl {
    border-left: 6px solid green;
    height: 500px;
}

<label htmlFor='ID'>EMPLOYEE #</label>
<input className="form-control w-25" id="ID" readOnly></input>
<div className="vl"></div>
<form data-transport-order="form">
<div className="form-group">
<label htmlFor='ID'>Invoice No.</label>
<input className="form-control" id="ID" readOnly></input>
<label htmlFor="TransportDate">Date</label>
<input type="date" className="form-control w-25" ID="TransportDate" autoFocus required></input>
</div>

Answer №1

Consider utilizing flex for a smoother and more suitable solution in this scenario.

Your component JSX:

<div className='form-container'>
    <div className='employee-id'>
        <label htmlFor='ID'>EMPLOYEE #</label>
        <input className="form-control w-25" id="ID" readOnly></input>
    </div>
    <form className='employee-details' data-transport-order="form">
        <div className="form-group">
        <label htmlFor='ID'>Invoice No.</label>
        <input className="form-control" id="ID" readOnly></input>
        <label htmlFor="TransportDate">Date</label>
        <input type="date" className="form-control w-25" id="TransportDate" autoFocus required></input>
        </div>
    </form>
</div>

Styles:

.form-container{
  display: flex;
  flex-direction: row;
}

.employee-id{
  display: flex;
  flex-direction: column;
  border-right: 6px solid green;
  margin-right: 10px;
  padding-right: 10px;
}

.employee-details .form-group{
  display: flex;
  flex-direction: column;
}

Result

<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <style>    
    .form-container {
      display: flex;
      flex-direction: row;
    }
    
    .employee-id {
      display: flex;
      flex-direction: column;
      border-right: 6px solid green;
      margin-right: 10px;
      padding-right: 10px;
    }
    
    .employee-details .form-group {
      display: flex;
      flex-direction: column;
    }
  </style>
</head>

<body>
  <div id="root">
    <div class="App">
      <div class="form-container">
        <div class="employee-id"><label for="ID">EMPLOYEE #</label><input class="form-control w-25" id="ID" readonly=""></div>
        <form class="employee-details" data-transport-order="form">
          <div class="form-group"><label for="ID">Invoice No.</label><input class="form-control" id="ID" readonly=""><label for="TransportDate">Date</label><input type="date" class="form-control w-25" id="TransportDate" required=""></div>
        </form>
      </div>
    </div>
  </div>
</body>

</html>

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

Aligning image vertically

I'm working on aligning an image vertically in my header. Currently, it's horizontally centered. header { background-color: blue; height: 118px; width: 1024px; text-align: center; } .container { margin-left: auto; margin-right: aut ...

Angular2-starter configuration setup with environment-based variables (such as .env or .conf) for testing and production settings

Frameworks like PHP Laravel often include files for local configuration, separate from dev, test, and production environments. How can a configuration file be provided for an angular-starter project that contains all local environment variable values (su ...

Looking for an Angular Material component that displays a list of attributes?

I am trying to create a dynamic list of properties in Angular using Material Design that adjusts for different screen sizes. For example, something similar to this design: https://i.stack.imgur.com/EUsmV.png If the screen size decreases, the labels shou ...

Transforming from React Static function to React ES6 syntax is a seamless

what is the process to change React static to React ES6? statics: { getInstanceCount: (function() { var count = 0; return function() { return ++count; }; }()) } Also, can you please guide me on how to implemen ...

Error: Unable to locate module: The requested module '@material-ui/data-grid' could not be found

As a newcomer to React, I encountered an error when trying to integrate Material UI data table into my salesTable.js file. The error message displayed is as follows: ERROR in ./src/SalesTable/SalesTable.js 5:0-50 Module not found: Error: Can't resolve ...

What are the best methods for concealing a ng-repeat element with AngularJS?

.controller('CouponsCtrl', ['$scope', '$http', '$window', '$location', '$ionicPopup','$ionicLoading', function($scope, $http, $window, $location, $ionicPopup,$ionicLoading) { ...

I wonder which Material Design repository is the source of this library

I am attempting to replicate the CSS style used in this particular Material Design-inspired web application: https://i.stack.imgur.com/utalx.png After exploring Materialize CSS and MUI, I have not been able to pinpoint the exact framework responsible for ...

inactive toggle being released

I am facing an issue with my two slider menus, where only the right menu holds the active value when clicked. The left menu slides out only when the toggle button is held down, but I need it to slide out when the toggle is simply clicked and not held down. ...

What are the alternative methods to execute a React.js application without using react-scripts?

After creating my React.js app using the command below: npx create-react-app my-app I'm now looking to modify the package.json script section to run the app without react-scripts. How can I achieve this? "scripts": { "start&quo ...

What could be causing these warnings to pop up when I am utilizing the useEffect hook in React.js?

Having some trouble with React hooks and JS. I keep getting warnings about missing dependencies in my code, even after reading the documentation. It's all a bit confusing to me. ./src/CustomerList.js Line 32:6: React Hook useEffect has a missing d ...

The npm http package exclusively includes a package.json without any accompanying JavaScript files

After installing an npm package that listed 'http' as a dependency, I also installed 'http'. However, all npm downloaded for 'http' was a package.json file that referenced a non-existent index.js file. Could it be that the ind ...

Adjust the top margin of content to account for the height of a fixed header

When dealing with a fixed header that has been removed from the HTML flow, it can be tricky to adjust the content below it. The challenge arises because the height of the header can vary based on screen size. How can we dynamically adjust the margin-top fo ...

Conceal div elements containing identical information by utilizing jQuery

I'm dealing with a webpage that pulls in a long section of divs from another application. Unfortunately, I can't filter the divs before they appear, but I urgently need to hide any duplicate data within certain values using jQuery. The duplicate ...

Adding the object's key to an array in JavaScript: A step-by-step guide

Among the objects in my possession are: robot { id skill currentWorkPlace } warehouse { aiStaff currentStatus boxes } I am tasked with creating a function that will add the id of a new worker to the aiStaff array and assign a reference to the ...

Performing a conditional query on a Many-to-Many relationship in TypeORM

Operating under a many-to-many relationship between Category and Product entities In need of filtering products based on category ID Attempted to implement the following code after referring to some examples, but encountered difficulties in making it fun ...

A guide on delivering the built Next.js app to the client

I recently started using Next JS and have developed a small application that involves API calls and other features. In the development process, I used the command npm run build to generate a .next folder for the build, and then ran the build using npm run ...

Conceal DIV containers during the loading of the page, and reveal them only upon the selection of Radio Buttons

In my user interface, I have implemented three radio buttons labeled as "Easy," "Medium," and "Hard." Each button is assigned to a distinct Javascript function that manipulates the visibility of corresponding div elements. The main purpose behind this setu ...

What is the reason for needing to specify event.target as an HTMLInputElement?

I am currently working on a codebase that uses Material Ui with theme overrides. As I set up my SettingContext and SettingsProvider, I find myself facing some syntax that is still unclear to me. Let's take a look at the following code snippet: const ...

The simultaneous use of trackball controls and GUI is not compatible

When I click on them, the GUI changes together and I have looked at other answers. However, I am not sure where to put the listener. I tried putting the listener in render(), but it still doesn't work. How can I fix my code? This coding is related to ...

Developing web components using angular.js while ensuring compatibility with IE11

I have an angular.js application where I need to initialize a web component. Everything runs smoothly on different browsers, however IE11 seems to have problems with document.importNode The angular.js onInit function is as follows: vm.$onIni ...