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

Cross-Origin Resource Sharing policy: Missing 'Access-Control-Allow-Origin'

While working on a React website with Node.js backend, I encountered an error. Click here for more details. ...

I will not be accessing the function inside the .on("click") event handler

Can someone help me troubleshoot why my code is not entering the on click function as expected? What am I missing here? let allDivsOnTheRightPane = rightPane.contents().find(".x-panel-body-noheader > div"); //adjust height of expanded divs after addi ...

Sharing data between sibling components becomes necessary when they are required to utilize the *ngIf directive simultaneously

Within my parent component, I am hosting 2 sibling components in the following manner: <div *ngif="somecode()"> <sibling1> </sibling1> </div> <div *ngif="somecode()"> <sibling1 [dataParams]=sibling1object.somedata> ...

Having problems getting my fixed header to work on my datatable. What could be the

Struggling to make my data table Thead sticky? I attempted using position: fixed;, top: 0; with CSS but it only worked in Firefox, not Chrome, Edge, or Opera. Here is an excerpt of my Ajax code: "stateSave": false, "orderCellsTop&quo ...

Java Script Custom Print Preview: A unique way to showcase your content

Is there a way to create a custom print preview dialog similar to the browser's print preview using Java Script? I am working on a book reader application that requires customization of the print preview dialog for page counting, automatic pagination, ...

Tips for designing a flexible structure with 2 columns, each containing an additional 2 columns within

Is it possible to create a 4-column responsive layout? | column left | column right | column left| column right| I would like to achieve a single row layout on larger devices as shown below | column left | column right | column left| column right| an ...

Using CSS height 100% does not function properly when the content overflows

Here's what's going on with this code snippet: HTML <div class="one"> <div class="will-overflow"> </div> </div> CSS html, body { width: 100%; height: 100%; } .one { height: 100%; background: r ...

How can we use Mongoose .find to search with an array stored in req.params and respond with an array containing each value along with its

It would be great if a user could input multiple tags in a search field, and have them separated client-side (before making the .get call) to send over ajax with each keypress. While testing the API with Postman on the server-side, if the .get method retu ...

What is the best way to showcase content using Chakra-ui SideBar in a React Application?

After exporting the SideBar, I imported it into my App.jsx SideBar.jsx 'use client' import { IconButton, Avatar, Box, CloseButton, Flex, HStack, VStack, Icon, useColorModeValue, Text, Drawer, Draw ...

Thumbnail Carousel Caption in Bootstrap 3

Is it possible to create a Bootstrap 3 carousel where the image changes when the mouse cursor hovers over the thumbnail under the carousel? Currently, I have a setup with the carousel and thumbnails below it. Typically in Bootstrap, the image changes autom ...

ng-repeat and $scope problem

I am having an issue with my page where I display 3 images in a row using Ng-repeat. When I click on any image, it only shows the first image that was displayed in that particular row. Template: <div id="galscrolldiv" class="row" ng-repeat="image in i ...

Directive unable to recognize ng-pattern functionality

I am attempting to encapsulate an <input> within a directive in order to manage date validation, conversion from string to Date object, and keep the Date version in the original scope. The functionality seems to be working as intended. However, the n ...

Error: Vue.js is unable to find the reference for "_vm.KisanData" and throws a TypeError

I need assistance in fixing an error that I am encountering. The issue arises in this method where I am using KisanData, but I am unable to resolve it. const API_URL = "http://localhost:3000/User"; export default { name: "home", info(){ ...

Developing a React-based UI library that combines both client-side and server-side components: A step-by-step

I'm working on developing a library that will export both server components and client components. The goal is to have it compatible with the Next.js app router, but I've run into a problem. It seems like when I build the library, the client comp ...

Floating and scrolling navigation bar not functioning properly in bootstrap framework

I've been dabbling in coding for a while now, practicing at my current job. I managed to create a floating and scrolling navigation bar on the right side of my website using bootstrap. However, after taking a 3-week break and returning to my site, I n ...

Chakra UI Not Displaying Proper Responsiveness on the User Interface

I recently integrated Chakra UI for styling a project on Next.js, and while most components are functioning properly, I am facing challenges with implementing responsive layouts. The styles do not seem to adapt when the screen size is reduced. Here's ...

Tips for maintaining position when refreshing a web page within a scrolling table

Recently, I came across a helpful tutorial on how to create a table with a fixed header and scrollable body. You can find it here. While the tutorial worked perfectly for me, I encountered an issue when trying to refresh the webpage and maintain my positio ...

"Empty array conundrum in Node.js: A query on asynchronous data

I need assistance with making multiple API calls and adding the results to an array before returning it. The issue I am facing is that the result array is empty, likely due to the async nature of the function. Any help or suggestions would be greatly appre ...

React: Implementing localStorage token addition in loginHandler function using State hook is not functioning as expected

I've implemented an AuthContextProvider in my React application to handle user authentication and logout functionality: import React, { useState } from "react"; import axios from "axios"; import { api } from "../api"; co ...

What are some ways to enhance the speed of my canvas animations?

My code generates imagedata and places it in a canvas. However, when I expand the window size, the rendering slows down significantly. Is there a way to optimize this for smooth operation in fullscreen mode, even though it might seem naive? What would be ...