Having trouble with showing dynamic data in column2 of my HTML layout, and the alignment doesn't look quite right in HTML

I'm working with this HTML file, attempting to create a two-column layout using HTML and CSS. I want one column to be labeled REQUEST and the other RESPONSE. When a value is entered in the text field in Column 1, it should display a response in Column 2.

Here's the style:

<style>
*{
  box-sizing: border-box; 
 }

.column {
  float: left;
  width: 50%;
  padding: 10px;
  height: 450px; 
}

.row:after {
  content: "";
  display: table;
  clear: both;
}

.row:after{

  width: 900px;
}

.submitBtn
{
  margin: 10px;
}

input{
  align-self: center;
}

@media screen and (max-width: 600px) {
  .column {
    width: 100%;
  }
}
#sbtbtn
{
  font-family:Verdana, Geneva, sans-serif;
  cursor:pointer;
}

</style>

The HTML body section:

 <div class="toolbar" role="banner">
      <img src="https://www.amazonlogo.com/webstatic/en_US/i/buttons/AMZ_logo_h_100x26.png" alt="logo" />
      <span>Welcome</span>
      <div class="spacer"></div>
 </div>

 <div class="content" role="main">
      <div class="row">
        <div class="column" style="background-color:#aaa;">
          <h2>REQUEST</h2>
        <div>
          <input type="text" [(ngModel)]="calId" placeholder="Enter CAL ID" class="user_id_text"/>
        </div>
        <div class="submitBtn">
          <input id="sbtbtn" type="submit" (click)="getById(calId)" value="submit"/>
        </div>
        </div>

        <div class="column" style="background-color:#bbb;">
          <h2>RESPONSE</h2>
          <div id="table">
             <table width="100%" class="table">
               <thead>
                <tr>
                 <th>Component Name</th>
                 <th>API Name</th>
                 <th>Error Message</th>
                </tr>
               </thead>
               <tbody>
                <tr *ngFor="let binary of data">
                  <td>{{binary.componentName}}</td>
                  <td>{{binary.apiName}}</td>
                  <td>{{binary.errorMessage}}</td>
                </tr>
               </tbody>
              </table>
             </div>
        </div>

    </div>

The resulting output from the above *.html code will look like Screenshot-1 below:

Screenshot-1:

https://i.sstatic.net/zLtr7.png

Upon entering a value into the text field and clicking the submit button, the view will change accordingly:

https://i.sstatic.net/krXLI.png

https://i.sstatic.net/18knB.png

Expected Result:

1. Aim for a two-column HTML layout without any background color.

2. Ensure that the text field and submit button are centered on column 1.

3. The results should neatly fit into column 2.

4. In case of expanding values, implement a sidebar within column 2 to display all data.

If you have experience with web design, assistance with achieving these goals would be greatly appreciated!

Note: This page is responsive and should function well across different devices.

Answer №1

Consider implementing flexbox instead of relying on floats.

.row {
    display: flex;
    flex-direction: row; //this line is optional
 }

.column {
    max-width: 50%;
    width: 50%;
 }

The overflow issue you are experiencing may be due to the data in your table exceeding the column's capacity, causing it to widen beyond its intended size.

In my opinion, switching to flexbox could address this problem rather than using a table structure. For more information on flexbox, you can refer to this guide: https://css-tricks.com/snippets/css/a-guide-to-flexbox/

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 can we eliminate the modal-open class in Angular when transitioning to a different URL?

Currently, I am facing an issue with a bootstrap modal. There is a button inside the modal which upon clicking should navigate the current component to another component named 'questions'. The problem arises when the new component is loaded, as t ...

Incorporating various elements within a single column of a table

I have been attempting to include multiple table cells elements beneath each of my heading cells, but I am facing issues in getting it to work properly. For better understanding, this is a screenshot: https://i.sstatic.net/kg2XR.png My goal is to have o ...

Sass can be used to create custom color classes for Bootstrap 5.3 that offer

I am currently using a Bootstrap 5.3 theme and I would like to give users the option to change the main color theme from the default blue to something like purple or orange. My idea is to create additional CSS files named "orange-as-primary.css", "purple- ...

Utilizing Angular to lazily load multiple routes/paths within a single module

I am currently in the process of setting up multiple horizontal routes (not nested) and grouping them into one lazy-loaded module. However, I am facing a challenge trying to properly match these routes within the lazy-loaded feature module itself. Below ...

What is the best way to include a .AVI file in an HTML document?

I have come across some examples of .AVI in HTML on the internet. However, my page seems to be having issues. It displays fine in Chrome on my computer. But in Internet Explorer, there is a bar at the top and the videos appear blank afterwards. It ...

Can you explain how this particular web service uses JSON to display slide images?

{ "gallery_images": [ {"img":"http://www.jcwholesale.co.uk/slider_img/big/1_1433518577.jpg"}, {"img":"http://www.jcwholesale.co.uk/slider_img/big/1_1433519494.jpg"}, {"img":"http://www.jcwholesale.co.uk/slider_img ...

Guide on using selenium webdriver (python) to choose, replicate, and insert all content within an element

Currently, I am faced with the task of transferring data from website A to website B as website A is soon going down. This includes not just text, but also images, hyperlinked text, and certain formatting requirements. Previously, the data transfer was don ...

Jasmine was unsuccessful in detecting a exported function being invoked by another function

In my code, I've created 2 helper functions where one is a shortcut to the other. I need to verify in my test that the shortcut function is actually calling the main function. Both functions are located in the same file: export function test1(param1, ...

Minimization tools for compressing CSS and JavaScript documents

After deploying my application, I noticed that the loading time has significantly increased. Is there a way to compress CSS and JS files? I include only the necessary code in each page and occasionally use minified versions of JS. Thank you. ...

Firebug displays the class name and location twice in the right panel

When examining a div labeled with .mlm-clearfix, I noticed that Firebug was displaying this class name and its URL twice in the right panel. The style declarations given for the Easy Clear Method in relation to this class are as follows: .mlm-clearfix:bef ...

"The combination of Windows, @font-face, and Cyrillic characters presents a

I am encountering an issue with font-face and Cyrillic characters. The fonts display properly in any browser on OS X, but fail to render on a Windows 7 machine (chrome, ie etc). Even after putting the fonts through Font Squirrel and testing the demo files ...

Having issues with image hover and click functionality

My website has an image with the cursor set to pointer and a function that should show a hidden element when clicked. However, it's not working at all. When I hover over it or click on it, nothing happens. Here is a screenshot of the issue along with ...

jquery function that switches image after the fifth mouseover event

I just can't seem to figure this out. I need a mouseover event that switches between two images until the fifth time you mouseover, then it changes to a third image. Here is my code so far: <!doctype html> <html> <head> <meta c ...

What is the best way to use jQuery to access dynamic HTML elements?

I have created a dynamic table that allows users to add and delete rows. However, I am facing an issue with accessing the information inputted by the users for calculations because it seems to be inaccessible once dynamically added to the page. Below are ...

My attempts to integrate PHP into jQuery tabs have been unsuccessful

My code seems to be acting strangely, as the PHP code I originally entered in tab 2 has somehow escaped that tab and spread into all the other tabs. This means it is visible in multiple tabs instead of just one. The purpose of this PHP code is to retrieve ...

The top section of the page is not properly aligned with correct bootstrap spacing and margins, leading to a

Inspiration theme: Porto (The work items on the right are aligned with the top of the viewable portion of the page) when selecting 'view all' on the left menu. Website using the Porto template: DMMBlitz (The work items on the right are NOT alig ...

CSS: Overlapping two divs with unique classes and varying margins - Unexpected occurrence or intentional design?

One thing I'm curious about: Will the margins of two different divs merge if they have the same value when intersecting? It appears so! Do paddings not merge when two different divs intersect, even if they have the same value? It seems that way! When ...

Tips for utilizing the nth-child selector to exclude hidden divs

I am facing an issue with displaying random blocks in rows. Each time a block falls into a new row, I want it to have a different style. However, when the user clicks on a button to hide certain blocks using display:none, the problem arises because the nth ...

Obtaining data from a Nested Json file in Angular 5

Encountering difficulties retrieving data from nested JSON. Error: 1. <h3>{{sampledata}}</h3> displaying [object Object] 2. <p>{{sampleDataModel.Title}}</p> ERROR TypeError: Cannot read property 'Title' of undefined ...

Efficient Ways to Present and Personalize Indian Date and Time using JavaScript

Hey there, currently creating my website and need some assistance. I'm looking to display the date and time in different sections of the page. Having some trouble with getting Indian time to work properly using PHP. If you could help me out with Ja ...