show an interactive table with 2 columns for easy printing

My table is generated dynamically to display the work done by employees within a specific time period. Each work item is listed as a new row with 4 columns containing information on time spent, costs, etc. The data looks like this:

Worker1
mailservice | 2h | 3$ | 6$
phonecalls | 1.4h | 2$ | 2.8$

Worker2
mailservice | 4h | 3$ | 12$
storage | 11h | 8$ | 88$

Worker3
phonecalls | 23h | 3$ | 69$

and so on. The number of rows for each worker varies based on their activities during the given time frame. Similarly, the number of workers can vary in a single time frame. After generating this detailed table on screen, I now need to print it out in landscape format across two columns, like this:

<div class="halfboxR" id="do-print" style="border:1px solid #000;"><table border="0" class="fontxsmall">
<!-- Table content here -->
      </table></div>

Answer №1

To ensure proper wrapping of tables, consider enclosing them all within an outer div element with a default width set. Inside this div, place the tables and apply a style of display: inline-block along with specific widths. This should allow the tables to wrap as needed.

For implementation, utilize the @media query in CSS; further details can be found at Media Queries.

With this approach, you can achieve a single column layout for the displayed page while having multiple columns for the printed page.

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

What steps can be taken to convert this function into a more concise, dry function?

I'm attempting to customize a typewriter effect on my webpage, and while it successfully displays predefined data, I am struggling with converting it into a function that can receive values and then display those values. I have made attempts to modif ...

The input field within the button stubbornly resists aligning with the right corner

Can anyone help me with using the class=float-right on the button labeled "Add to cart"? It seems to be not aligning properly, especially when I increase the width of the card. The "Add to cart" button is sticking to the "Descripti ...

Adding multiple lines of text using jQuery

I am facing an issue while trying to append a string to an HTML element. It works perfectly fine with a single line string, but breaks when I try to split it into multiple lines. <div><h4 >List to do:</h4><span id="added"></span ...

Avoiding flickering when the browser back button is clickedAvoiding the flickering effect

As I work on developing an Asp.Net application, a challenge has arisen. In order to prevent users from navigating back to the login page after logging in, I have implemented JavaScript code successfully. However, when clicking the browser's back butto ...

Is it possible to create a French flag using only CSS within one div?

What is the semantically correct way to display the French flag using only HTML and CSS? <div id="flag"> <h1>French flag</h1> </div> To represent the French flag with pure CSS (33% blue, 33% white, 33% red), you can use the fo ...

Emphasize the search term "angular 2"

A messenger showcases the search results according to the input provided by the user. The objective is to emphasize the searched term while displaying the outcome. The code snippets below illustrate the HTML and component utilized for this purpose. Compon ...

The custom width is not being applied to the Bootstrap column

I'm working on a Web Design project using Bootstrap. Here is a snippet of my HTML code: <div class="col utility_col"> <div class="row"> <div class="col vote_col">Vote</div> <div class="col sign_col"> < ...

Contingent creation of HTML

I am working on a logic that should display an error message in the form of a label when a certain condition returns false. So far, I have attempted to use Response.Write without success. if (bannedDomainText.Text.Contains(".")) File.AppendAllText(M ...

Obtain User Input from a TextArea Element on an HTML Page using ASP.net

In my asp.net 4.0 project, I am using jTemplates to create a HTML-Page that includes a text area and a submit button. I am looking for a way to retrieve the value entered in the text area when the user clicks on the submit button. Can anyone provide guid ...

jQuery - Enlarge Tree View to the level of the selected node

I am struggling to figure out how to expand the tree view up to a selected node level. If anyone has any ideas on how to accomplish this, please let me know. For instance, if we click on 'Parent d' in the 'Category list', I want to exp ...

Having trouble using Selenium for Chrome to locate an element in an HTML file using C#?

I am currently utilizing Selenium to locate elements within an HTML document that is being displayed in the Chrome browser. Unfortunately, the HTML code is not created by me and appears to have numerous issues. I do not have the ability to modify how it is ...

Handling a change event for a mat-datepicker in Angular 7 can be tricky, especially when its value is tied to an optional input parameter. Let's dive into how to

I've recently started working with angular development and encountered a challenge with a mat-datepicker. The value of the datepicker is connected to filterDate using [(ngModel)] as an @Input() parameter. I have implemented a handleChange event that e ...

Unable to transmit form information using HTML/JavaScript/Express Node application

I'm facing a challenge in developing an app that allows me to input event information and then display it on a map. I'm encountering difficulties at the initial stage when it comes to saving the data. Even though Chrome's Inspect tool indica ...

Twig: A guide to showcasing HTML content within block titles

Within my Symfony2 project, I am utilizing various twig templates. One of these templates contains a block labeled title. {% block title %}{{ announcement.title }}{% endblock %} The issue arises when the variable {{ announcement.title }} contains HTML ta ...

Automatic Full-Screen Switching Upon Video Playback in HTML5

Currently, I have a video clip set to play when the timer reaches a certain point. My goal is for the video to automatically enter full-screen mode when it starts playing and return to its original position when it stops, as the timer will continue ticking ...

Position the button at the bottom of a div

I am currently utilizing Bootstrap 4.5, however, the following is just a brief demonstration of my desired outcome. Within the dimensions of a fixed-width and height card, I aim to have the content occupy all remaining space while ensuring the button stay ...

Unable to save the ID of an element into a jQuery variable

I am currently working on a project that involves an unordered list with anchor tags within it. I am trying to access the id of the li element that is being hovered over, but for some reason, the alert is returning undefined or nothing at all. Here is the ...

When an image is added, it will display against a backdrop of pure white

Hey there, I have a question regarding an image on my website. I removed the background using PowerPoint, but when I upload it, there is still a white background around it. Even changing the background color doesn't remove the white outline. Any tips ...

Is there a way to use jQuery to efficiently refresh all values within a table?

Whenever I click the "Update All" button, I want all the CHANTIERS values in each line of the list of SALARIES to be checked and updated according to the value selected in the dropdown list. For example, if I choose the value 1 in the dropdown list and cli ...

"Styling a play button on top of an image using CSS

Can someone please assist me in properly displaying a play button over a thumbnail using CSS in my WordPress site? I have tried various methods without success. Any guidance on where I may be going wrong would be greatly appreciated. .post-thumbnail-sid ...