Arrange one <div> to the left and one <span> to the right with justified spacing in between

I am currently working on aligning the label tag, text, and submit input types to the left side of the page, while also ensuring that the 17 total orders are aligned to the right. The goal is to have them vertically aligned with the Date label and horizontally aligned with the end of the paragraph tag that reads "Shipping List is Finalized Everyday at 5pm EST".

My progress so far includes successfully aligning the label tag and two input tags as desired. However, I am encountering difficulty in getting the span tag to align completely to the right side. This project is being developed using bootstrap 4.1.1.

Below is a snippet of my code:

.main {
  margin: 15px 0;
}

.btn-appear {
  color: #000000;
  background-color: #e6e6e6;
  border: 3px solid #b3b3b3;
}

.btn-appear:focus {
  box-shadow: 0 0 0 .1em rgba(186, 208, 226, .5);
}

.btn-appear:active {
  color: #ffffff;
  background-color: #4d4d4d;
  border-color: #bad0e2;
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" />

<div class="row main" style="background-color: #ffffff">
  <div class="col-12">
    <h3>Shipping / Loading List</h3>
    <div class="">
      <p class="float-left">Select Shipping / Loading Date</p>
      <p class="float-right">Shipping List is Finalized Everyday at 5pm EST.</p>
    </div>
    <div class="row container justify-content-between">
      <div class="col-4 row" style="background-color: antiquewhite">
        <form method="post">
          <div class="form-group">
            <label class="control-label d-block" for="date">Date:</label>
            <div class="form-inline d-inline-block">
              <input class="form-control" id="date" name="date" size="10" placeholder="MM/DD/YYYY" type="text" />
              <input class="btn btn-appear" name="submit" type="submit" value="Search">
            </div>
          </div>
        </form>
      </div>
      <span class="col-4 text-right" style="background-color: aliceblue">
  17 Total Orders for <span id="demo"></span>
      </span>
    </div>
  </div>
</div>

Answer №1

.main{
     margin-top: 15px;
}
 .btn-appear{
     color: #000000;
     background-color: #e6e6e6;
     border: 3px solid #b3b3b3;
}
 .btn-appear:focus{
     box-shadow:0 0 0 .1em rgba(186,208,226,.5);
}
 .btn-appear:active{
     color:#ffffff;
     background-color: #4d4d4d;
     border-color: #bad0e2;
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container">
  <div class="row main" style="background-color: #ffffff">
    <div class="col-12">
      <h3>Shipping / Loading List</h3>
      <p class="float-left">Select Shipping / Loading Date</p>
      <p class="float-right">Shipping List is Finalized Everyday at 5pm EST.</p>
    </div>
  </div>
  <div class="row justify-content-between">
    <div class="col-4" style="background-color: antiquewhite">
      <form method="post">
        <div class="form-group">
          <label class="control-label d-block" for="date">Date:</label>
          <div class="form-inline d-inline-block">
            <input class="form-control" id="date" name="date" size="12" placeholder="MM/DD/YYYY" type="text"/>
            <input class="btn btn-appear" name="submit" type="submit" value="Search">
          </div>
        </div>
      </form>
    </div>
    <span class="col-4 text-right" style="background-color: aliceblue">
    17 Total Orders for <span id="demo"></span>
    </span>
  </div>
</div>

Answer №2

Apologies for the delay in sharing my updated solution. I made several changes to it. Here is the revised code snippet:

.main{
  margin: 15px 0;
}

.btn-appear{
  color: #000000;
  background-color: #e6e6e6;
  border: 3px solid #b3b3b3;
}

.btn-appear:focus{
  box-shadow:0 0 0 .1em rgba(186,208,226,.5);
}

.btn-appear:active{
  color:#ffffff;
  background-color: #4d4d4d;
  border-color: #bad0e2;
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet"/>

<div class="container">
  <div class="row main">
    <div class="col-12">
      <h3>Shipping / Loading List</h3>
      <p class="float-left">Select Shipping / Loading Date</p>
      <p class="float-right">Shipping List is Finalized Everyday at 5pm EST.</p>
    </div>
  </div>  
  <!-- Form code begins -->
  <div class="row main justify-content-between">
    <div class="col-4">
      <form method="post">
        <div class="form-group">
          <label class="control-label d-block" for="date">Date:</label>
          <div class="form-inline d-inline-block">
            <input name="date" class="form-control" id="date" type="text" size="12" placeholder="MM/DD/YYYY">
            <input name="submit" class="btn btn-appear" type="submit" value="Search">
          </div>
        </div>
      </form>
    </div>
    <div class="col-4 text-right">
      17 Total Orders for <span id="demo">Wed Aug 29 2018</span>
    </div>
  </div>
</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

"Enhance Your Website with a NodeJS HTML5 Audio Player for MPEG

We have encountered a situation where we are being provided with a direct link to an MPEG audio file from a specific web streaming API. The challenge is that the file is not a typical MP3 with an MPEG codec, but rather an MPEG video format containing only ...

Using ng-repeat in AngularJS to create a dynamic carousel

My attempt at creating a carousel using ng-repeat was partially successful. Although the images load correctly, I encountered an issue with the previous and next buttons not functioning as expected. Here is the code snippet I used: <div id="carouselE ...

Writing in Arabic within an HTML header is not allowed

I have downloaded a CSS template and am currently in the process of translating it to Arabic with the use of UTF-8 encoding: <meta http-equiv="content-type" content="text/html; charset=utf-8" /> Everything appears fine when I write in Arabic outsid ...

The horizontal scrollbar is not displaying

(RESOLVED) Currently, I am developing a movie app that displays film titles through an Accordion feature using Bootstrap. Specifically, I have created an Accordion that showcases movies added to a favorites list. The intention is for this favorites secti ...

Is it possible to utilize a JavaScript framework within a Chrome extension?

Currently, I am developing a chrome extension that adds a toolbar to the DOM dynamically. In order to find, attach, and manipulate elements, I have been using CSS selectors in JavaScript. However, this approach has proven to be fragile as any changes made ...

Issues with Bootstrap slider functionality : Unable to initiate slider as it is not being recognized as

I'm having an issue with my Bootstrap slider not functioning properly. Despite ensuring that all CSS and JS files are loading correctly in my HTML, I keep receiving an error in the console stating: slider is not a function. I have even downloaded the ...

CSS: Create a form with two input fields where the left field is adjustable in width and the right field fills up

------------- -------------------------------------------------- | some unique text | | some more original content, varying length | ------------- -------------------------------------------------- |<---------------------- 100% width ------------------ ...

Ways to combine multiple CSS styles for an element using .css()

I'm struggling to apply styles to a deeply nested element using jQuery and JavaScript. I understand how to style nested elements, but I'm having trouble targeting a specific deeply nested element. My website is built on WordPress, and it has ins ...

Enhancing Vertical Expansion of List Items (Twitter Ticker) through Responsive Design

Hey there! I've added a Twitter feed to my website, and you can check it out here: anibalcascais.com/tweet/twitter.html I'm working on making the layout of the feed responsive. Right now, the container div adjusts nicely, but when the browser wi ...

What is a sophisticated method to hide an element from view?

My dilemma involves a dropdown menu and a list of elements that are initially set to hidden using CSS. When an item is selected from the dropdown, it becomes visible. However, I am struggling with finding a way to revert the previously selected element b ...

Tips for aligning a row of images to the right in Bootstrap 4

I have several images that I want to display on the right side in a block. Here is what I attempted: <div class="row" > <div class="float-right"> <img src="1.png"/> <img src="2.jpg"/> ...

A guide to setting up a Python CGI web server on a Windows operating system

I am looking to set up a basic Python server on a Windows system to test CGI scripts that will ultimately run on a Unix environment. However, when I access the site, it displays a blank page with no source code visible. I am struggling to identify the issu ...

Mobile-friendly persistent navigation located beneath the header, inspired by the iOS7 browser design

This issue is really causing me a headache and slowing down progress on my project because I can't seem to figure it out. Currently, I am working on designing a mobile-friendly website and conducting tests in iOS7/OSX. The layout I am aiming for inc ...

Unable to get Bootstrap 4 modal to function properly when combined with an anchor tag

I have successfully implemented this feature with bootstrap 3, but I am facing issues with bootstrap 4. When I click on the buttons created using the anchor tag, the modal does not appear. I have checked other posts with similar problems, but most of them ...

Show or hide a specific element based on whether a certain radio button is selected or deselected

After successfully displaying an element on radio button selection, I encountered the issue of the selected element remaining visible when another radio button in the group is chosen. What aspect am I overlooking? Regarding hiding elements with vanilla Ja ...

Only render the div content in jQuery when the user has made a selection

Looking to optimize my website by incorporating tabs with a large amount of HTML content without slowing down the page load. Is there a way to use jQuery to load the div content only when each tab is selected? The basic structure of the HTML code would be ...

Adjust the size of the text and save it in a cookie for later use

I am in need of a script that can dynamically increase and decrease the font size on a website while retaining the user's chosen setting even after they return to the site. I believe utilizing cookies is the way to achieve this functionality. Despite ...

What is the best way to transfer data to a different section of my HTML webpage using PHP?

Can data be passed from an array to another part of the html code that is not in the same file? In file item.php and index.php, there is an array with objects. The goal is to include item.php as many times as the count of items in the array and send diffe ...

At a specific point in the route, all CSS and JS links in Node.js vanish

Hey everyone, I'm facing a strange issue where the CSS styling and JS code are not loading when I access the route http://localhost:5000/posts/edit/<%=idofblog%>. As a result, my webpage looks very unattractive, and I'm not sure what's ...

What steps can be taken to modify Gmail settings so that annotations are visible in the promotions tab?

I'm currently looking into how to properly utilize annotations in the promotion tab. I sent a test email to myself, but I am unable to see any annotations in my promotion tab. Is there a specific setting within Gmail that needs to be adjusted in order ...