Divide the bootstrap form from the outcome

I am in the process of developing a basic web application using Bootstrap that involves taking user input on a form, sending it to a database, and then displaying the data in a table below the form. The main challenge I am facing relates to the styling aspect of the project. My objective is to clearly demarcate the two sections as illustrated in my desired output compared to the current setup (refer to the image).

Despite researching multiple solutions on platforms like Stack Overflow and others, I have been unable to find a suitable resolution thus far. I suspect that the issue might be straightforward (even though I'm not entirely certain) and hope that a simple fix exists for the problem.

Below is an excerpt from my HTML:

<!-- Omitted default bootstrap script/css calls for simplicity -->
<!doctype html>
<html lang="en">
  <head>
    <link rel="stylesheet" href="styles.css"></script>
  </head>

  <body class="container">
    <div class="logo">
        <h1 class="headline">Text Items</h1>
    </div>

    <div class="main">
        <!-- Form content here -->
    </div>
  </body>
</html>

(Default bootstrap script/css calls were excluded to maintain clarity)

I attempted segregating each element into separate <div> containers but encountered no success. Additionally, when populating the table with data, the white background extended along with the table rendering. As such, I aimed to implement a scrollable table within the second <div>.

The following snippets represent the CSS configurations utilized:

<!-- CSS code snippet goes here --> 

The final outcome comprises incorporating two distinct <div>s which house the form component and the resultant data table respectively. Although seemingly uncomplicated, I aim to optimize this structure accordingly. Any advice or guidance would be greatly appreciated. Thank you!

Answer №1

Arrange form and table containers as siblings with white backgrounds, utilizing margin to separate them and padding to organize elements within. You can make use of Bootstrap's helper classes (m-, p-) or create your own custom styling.

<!doctype html>
<html lang="en>

<head>
  <style>

  </style>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap/dist/css/bootstrap.min.css" integrity="sha384-zCbKRCUGaJDkqS1kPbPd7TveP5iyJE0EjAuZQTgFLD2ylzuqKfdKlfG/eSrtxUkn" crossorigin="anonymous">
</head>

<body class="container bg-info">
  <div class="logo">
    <h1 class="headline">Text Items</h1>
  </div>

  <div class="main">

    <form onsubmit="postText()" class="bg-white mb-5 p-3">
      <div class="form-group">
        <label for="inputText">Text</label>
        <span><i class="fas fa-th-list"></i></span>
        <input type="text" class="form-control" name="inputText" id="inputText" placeholder="Enter Text ...">
      </div>


      <div class="form-group">
        <label for="inputDate">Date</label>
        <span><i class="fas fa-calendar-alt"></i></span>
        <input type="date" class="form-control" name="inputDate" id="inputDate">
      </div>

      <button type="submit" class="btn btn-primary" id="submission">Submit <i class="fa fa-sign-in" aria-hidden="true"></i></button>
      <button type="button" class="btn btn-primary invisible" id="update">Update <i class="fa fa-sign-in" aria-hidden="true"></i></button>
      <button type="button" class="btn btn-primary invisible" id="clearUpdate" onclick="clearUpdateFields()">Clear <i class="fas fa-times" aria-hidden="true"></i></button>
    </form>




    <div id="nothingExists" class="bg-white p-3">

      <button type="submit" class="btn btn-primary" onclick="getTexts()">Get List <span><i class="fas fa-th-list"></i></span></button>
      <table id="dataTable" class="table table-striped table-bordered">
        <thead>
          <tr>
            <th class="mySortable" onclick="sortTable(0)">Item</th>
            <th class="mySortable" onclick="sortTable(1)">Date</th>
            <th>Options</th>
          </tr>
        </thead>

      </table>

    </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

How to create space between elements in CSS without using margin or padding?

Recently, I stumbled upon a fascinating website while working on my own CSS grid project: I am curious to know how it was achieved. The Portfolio elements on the website have space between them without any visible margins or paddings that I could identify ...

Spacing between columns in Bootstrap5 for responsive design

In my Django app, I am utilizing Bootstrap for styling columns. I have successfully created a responsive layout that stacks vertically after a specific breakpoint using classes. Now, my goal is to add some space or gutter between the columns while maintai ...

Aligning a bootstrap button group at the center of a container

Looking for suggestions on how to center a Bootstrap button group (btn-group) within an element? For instance, consider the following structure: <div id='toolbar'> <div class="btn-group"> <button type="button" class="b ...

Places & Their Accompanying Pictures

My website has a feature that allows users to save and add images for locations they have visited. The location details are stored in a MySQL database, while the image files are saved on my server in a folder with both original and thumbnail versions. I h ...

Design of the content layout for the PHP mail function

After submitting a form on a website, the text entered is saved in a database. I attempted to send this text via email to a recipient using the following code: $recipient = $emailaddress; $subject = 'xxxx'; $header = 'From: xxxx < ...

Display sub navigation when clicked in WordPress

I currently have the default wordpress menu setup to display sub navigation links on hover, but I am interested in changing it so that the sub navigation only appears when the user clicks on the parent link. You can view my menu here https://jsfiddle.net/f ...

What is the best way to showcase a single <ul> list in an infinite number of columns?

Utilizing Django on the backend, I aim to showcase the list below in an unlimited number of columns with overflow-x: auto. <ul class="list"> {% for i in skills %} <li>{{i}}</li> {% endfor %} </ul> Example Result: 1 7 ...

The Microsoft Booking feature is not being shown in the iframe

https://i.sstatic.net/QYNGI.png Instead of the booking website, this is what is being displayed. Below is the code snippet: index.js import React from 'react' const Appointment = () => { return ( <iframe src='https://outlook ...

Is there a way to disable the calendar linking feature in the iPhone Mail Client

I am currently working on an application where I generate emails with time stamps. However, when viewing these emails in the iPhone mail client, the timestamp gets turned into a link with an ugly blue color and underline. Is there a way to prevent this fro ...

Switching images between mobile and desktop view in responsive mode is a useful feature for optimizing

Within a specific folder structure, I have a collection of images designated for both desktop and mobile displays: img: img-1.png img-2.png img-3.png img-4.png img-5.png img-6.png img/mobile: img-1.png img-2.png ...

Tips for creating a "sticky" button in Angular that reveals a menu when clicked

Is there a way to incorporate a feature similar to the "Get help" button on this website: The button, located in the lower right corner, opens a sticky chat menu. I am interested in adding dynamic information to the button (such as the number of tasks a u ...

Hover effects in CSS animations can be hit or miss, with some working smoothly while others may

Below is the HTML content: <div class="wrapper"> <figure align="center"><img src="http://www.felipegrin.com/port/or-site.jpg" alt=""><br><span>RESPONSIVE HTML5 WEBSITE FOR <br> OR LEDS COMPANY</span></fig ...

"Utilize Selenium to navigate and select a menu option with a

In my dropdown menu, I am trying to use Selenium to move the mouse to the Documentation menu item and click on the App Configuration option within it. The mouse hover function is working properly, but I am unable to click on the App Configuration element. ...

Enhancing HTML Vue JS by Dynamically Adding Rows Based on Multiple Selections

<div id="addForm"> <div class="row"> <div class="col-md-4"> <div class="form-group label-floating"> <label class="control-label">Case Type</label> <select class="form-control" v-mo ...

Clicking the popup form causes it to blur out

Having trouble with a blurry pop-up form when clicking the button? Check out the code I've used below: <button class="btn btn-default" data-toggle="modal" data-target="#myModal">ENQUIRE NOW</button> ...

Create custom buttons in Material-UI to replace default buttons in a React modal window

How can I prevent overlay on material-ui's RaisedButton? When I open a modal window, the buttons still remain visible. Which property should be added to the buttons to disable the overlay? Any assistance from those familiar with material-ui would b ...

Positioning a pair of dropdown menus side by side

Could anyone provide guidance on how to position two select boxes side by side within a table cell, ensuring they are responsive at the same time? Any help would be greatly appreciated. Thank you in advance! ...

Show data in a popup using jQuery DataTables and loading content asynchronously via Ajax

I am attempting to display a list in a popup based on an Ajax request. Prior to the Ajax call, the list is contained within the popup. However, after the Ajax request, the list remains on the page instead of inside the popup, and the old list still appears ...

PHP code to insert a advertisement div after every 5 rows of results

Is there a way to dynamically insert a div after every fifth row on a result page? I am currently using a script that displays 15 rows from a database with each pagination. Here is my complete script: <?php $sql = "SELECT COUNT(id) FROM table"; ...

Preventing Internet Explorer from automatically scrolling to the top of the page when a new HTML element is dynamically inserted using

On my webpage, I have an ASP:Grid with a small copy button in each row to copy the text inside that cell. The javascript function I created for copying the text is as follows: var copyText = function (textToCopy) { $(".copy").append("<textarea id=&ap ...