Element DIV enclosed within a <tr> element

I'm having trouble adding a <div></div> block inside a <tr> block after the end of the <td> blocks. The issue is that it keeps shifting to above the table structure. Here's an example of what I want to achieve:


                <table class="table">
                    <tr>
                        <th>Header 1</th>
                        <th>Header 2</th>
                        <th>Header 3</th>
                        <th>Header 4</th>
                    </tr>
                    <tr>
                        <td>Info 1</td>
                        <td>Info 2</td>
                        <td>Info 3</td>
                        <td>Info 4</td>
                        <div class="progressInfo">
                            <div class="progressBar">A horizontal progress bar indicating the completion of work.</div>
                            <div class="textStatus">209133 left    444444 teams</div>
                        </div>
                    </tr>
                </table>
            

I'm looking for a way to ensure the <div></div> stays within the table row without being misplaced. Any suggestions on how I can achieve this? Also, just to note, I am using Bootstrap.

CSS

.table>tbody>tr>td,
.table>tbody>tr>th,
.table>tfoot>tr>td,
.table>tfoot>tr>th,
.table>thead>tr>td,
.table>thead>tr>th {
  vertical-align: middle;
  border-top: 1px solid #eee
}

Answer №1

It is necessary to create a new row with <tr> tag and include colspan="4" in the td element

.table {
border-collapse: collapse;
}

.table>tbody>tr
 {
  vertical-align: middle;
  border-bottom: 1px solid red;
}
<table class="table">
    <tr>
      <th>Header 1</th>
      <th>Header 2</th>
      <th>Header 3</th>
      <th>Header 4</th>
    </tr>
    <tr>
      <td>Info 1</td>
      <td>Info 2</td>
      <td>Info 3</td>
      <td>Info 4</td>

    </tr>
    <tr>
          <td colspan="4">
      <div class="progressInfo">
         <div class="progressBar">A horizontal plane progress bar here stating the completion of the work done.</div>
         <div class="textStatus">209133 left    444444 teams</div>
      </div>
      </td>
    </tr>
        <tr>
      <td>Info 1</td>
      <td>Info 2</td>
      <td>Info 3</td>
      <td>Info 4</td>

    </tr>
        <tr>
          <td colspan="4">
      <div class="progressInfo">
         <div class="progressBar">A horizontal plane progress bar here stating the completion of the work done.</div>
         <div class="textStatus">209133 left    444444 teams</div>
      </div>
      </td>
    </tr>
</table>

Answer №2

It is not logical to place a div tag within a tr tag. Consider adding the div element within a td tag instead.

Answer №3

Is this the correct format?

<table>
  <tr>
    <th>Header 1</th>
    <th>Header 2</th>
    <th>Header 3</th>
    <th>Header 4</th>
  </tr>
  <tr>
    <td>Info 1</td>
    <td>Info 2</td>
    <td>Info 3</td>
    <td>Info 4</td>
  </tr>
  <tr>
    <td colspan="4">
      <div class="progressInfo">
        <div class="progressBar">A progress bar indicating completion of work done in a horizontal layout.</div>
        <div class="textStatus">209133 remaining out of 444444 teams</div>
      </div>
    </td>
  </tr>
</table>

Answer №4

If you want to display a table with progress information, you can use the following code snippet:

<table>
    <tr>
      <th>Header 1</th>
      <th>Header 2</th>
      <th>Header 3</th>
      <th>Header 4</th>
    </tr>
    <tr>
      <td>Info 1</td>
      <td>Info 2</td>
      <td>Info 3</td>
      <td>Info 4</td>
    </tr>
    <tr>
      <td colspan="4">
        <div class="progressInfo">
           <div class="progressBar">You can add a horizontal progress bar here to show work completion.</div>
           <div class="textStatus">209133 left    444444 teams</div>
        </div>
      </td>
    </tr>
</table>

Answer №5

Is it possible to add a footer to each <tr> in this manner?

.table>tbody>tr>td,
.table>tbody>tr>th,
.table>tfoot>tr>td,
.table>tfoot>tr>th,
.table>thead>tr>td,
.table>thead>tr>th {
  vertical-align: middle;
  border-top: 1px solid #eee
}
<table class="table">
    <tr>
      <th>Header 1</th>
      <th>Header 2</th>
      <th>Header 3</th>
      <th>Header 4</th>
    </tr>
    <tr>
      <td colspan="4">
        <div class="progressInfo">
         <div class="progressBar">A horizontal plane progress bar here stating the completion of the work done.</div>
         <div class="textStatus">209133 left    444444 teams</div>
      </div>
      </td>
     </tr>
    <tr>
      <td>Info 1</td>
      <td>Info 2</td>
      <td>Info 3</td>
      <td>Info 4</td>
      </tr>
     <tr>
      <td colspan="4">
        <div class="progressInfo">
         <div class="progressBar">A horizontal plane progress bar here stating the completion of the work done.</div>
         <div class="textStatus">209133 left    444444 teams</div>
      </div>
      </td>
     </tr>
      
</table>

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

The callback function for ajax completion fails to execute

My current framework of choice is Django. I find myself faced with the following code snippet: var done_cancel_order = function(res, status) { alert("xpto"); }; var cancel_order = function() { data = {}; var args = { type:"GET", url:"/exch ...

Implement Offcanvas feature with Bootstrap 3 Navbar set to Fixed Top position

I am in the process of creating a website that will feature a large menu. However, I am not a fan of the collapsed menu that comes with BS3. Instead, I would like to implement a drawer or off-canvas menu similar to the one showcased in BS3's offcanvas ...

Checking the compatibility of a high resolution laptop on a low resolution laptop

Current Dilemma: Currently working on making a website adaptive for my job. I have successfully adjusted the media queries and CSS for my 2012 non-retina MacBook Pro and iPhone retina screens. However, when I tested the site on a MacBook Pro with retina d ...

How can I change it so that clicking on the YouTube icon directs me to www.google.com?

I have a YouTube icon on my website and I want it to redirect me to Google.com when clicked. However, it is not working as intended. I am trying to implement this functionality using JavaScript. HTML <div class="yt" > <i class=" ...

Troubleshooting: CSS button animation not functioning

Attempting to create a hover animation for buttons on my webpage, I crafted the following CSS code: #B1 { margin: 50px; margin-top: 50px; margin-bottom: 50px; flex: 1 1 auto; padding: 20px; border: 2px solid #f7f7f7; text-align: center; te ...

Having trouble getting the CSS checkbox:checked selector to work properly?

My attempt at changing the color of some text within a table based on checkbox selection doesn't seem to be working. The :checked attribute isn't having any effect. Here's the code snippet: <html> <head> <style type="text/css ...

Acquire "td" elements utilizing the combination of DOM and PHP

As a newcomer to the coding world, I am currently exploring an open source solution known as 'GLPI' that implements the MVC method for code management. However, I am facing challenges in modifying the code to hide certain records in a table on a ...

able to move through the content without displaying the scrollbar

I am looking to keep my content able to scroll, but I don't want the scrollbar to be visible. I have written my CSS like this: #content-three{ width:100%; height:100%; position:relative; overflow:hidden; } .block_s{ width:90%; ...

Updating a Specific Database Entry in Django Using Multiple Field Values

Hey there, I'm still learning the ropes and haven't had much time to really dive into it yet. My end goal is to create a "check-in/check-out" system by updating a timestamp from NULL to the current time based on employee number and work area. He ...

Having trouble loading popper.js using Laravel mix and webpack

I have been working on my project with Bootstrap 4 beta and Laravel 5.4, using npm and Laravel mix to load my JavaScript dependencies. Everything was going smoothly until I encountered an error while trying to use Bootstrap JavaScript methods. The error me ...

What is the best way to set a textbox as read-only using jQuery?

Seeking guidance on how to make a textbox readonly using a combination of knockout and jquery. Any advice on achieving this in either knockout or jquery would be appreciated. ...

Steps for accessing the `<img>` tag within an `<a>` tag to focus on the `<img>` element in Internet Explorer

How can I target the img tag inside an href tag to set focus on the <img> element? For example: <a href="#"><img class="img1" src="abc.png"/></a> The CSS selector a .img1:focus {} does not seem to work. I am unable to access the ...

The toggle button in the navbar takes its time to vanish completely

Every time I try to close my navbar, it seems to take forever for the navbar to disappear. Below is the code snippet: HTML <!-- logo --> <div class="logo"> <img src="assets/logo.png" alt="logo g's s ...

Having trouble with implementing a jQuery if/else statement with the :not selector?

Visit this link for a demonstration Using jQuery to determine positivity or negativity if ($("h1.change:contains('-')")) { $("h1.change").append(" it's negative"); } else if ($("h1.change:not(contains('-'))")) { $("h1.cha ...

PHP method that invokes HTML code

I recently developed a registration and login system using object-oriented PHP. I am now looking to make the HTML code accessible from within a PHP method. Below is the View.php class that contains methods for creating the login and registration UI: < ...

What is the best way to apply styles to a React component that is passed as a prop?

I'm currently working on a component that is passed as a label prop. In order for me to utilize justify-content: space between within my div, I must ensure it has a width of 100%. You can see how this appears in the developer tools by clicking here. r ...

FormData enables uploading of several images through distinct fields simultaneously

Looking to upload images to the server before submitting the form? Unable to nest forms, FormData() is being utilized. The form includes a title and 5 images with captions. The goal is to initiate the upload once an image is selected without clicking &apo ...

Is it possible for IE7/8 to show position:relative elements in front of position:absolute ones?

The layout I have created utilizes absolute positioning and includes a CSS-based menu in the header section. It functions perfectly in Firefox, however, when viewed in Internet Explorer 7 and 8, the menu dropdowns are hidden by the content area. Unfortunat ...

I am looking for a way to retrieve the ids of all div elements that have the same x coordinate using document.elementFromPoint in JavaScript. Can someone help me with

Currently, I am facing an issue where I have two divs positioned at the same x coordinate. I am attempting to retrieve the IDs of both divs using document.elementFromPoint(). However, I am only able to receive the ID of one div. var elem = document.elem ...

Beginning the phone application using either HTML5 or Cordova

Is there a way to use either HTML5 or Cordova (PhoneGap) to initiate a call to a phone number? I am looking to create a button that says "Call 555-555-5555", and when clicked, it opens the phone app on the device with that specific number. ...