Make the final <td> within a <tr> element act as a separate row

Is it possible for the last < td > in a < tr > to act like a completely new row without relying on jQuery or JavaScript?

<table>
 <tr>
  <td>normal td</td>
  <td>normal td</td>
  <td>normal td</td>
  <td class="i-want-to-be-a-row">row content</td>
 </tr>

In this scenario, I want the "i-want-to-be-a-row" td to function as a new row.

I attempted something like this:

.i-want-to-be-a-row {
 display:block;
}

However, I believe this is not the correct approach ;)

Answer №1

This solution utilizes flexbox for a cleaner layout:

CSS

table, tbody, tr, td {
    display: block;
}
tr {
    display: flex;
    flex-flow: row wrap;
}
td {
    flex: 1 0 30%;
    border: solid 1px green;
}

HTML

<table>
    <tr>
        <td>normal td</td>
        <td>normal td</td>
        <td>normal td</td>
        <td class="i-want-to-be-a-row">row content</td>
    </tr>
</table>

SEE DEMO HERE

Answer №2

Have you considered placing it in a separate row?

<tr>
  <td>regular td</td>
  <td>regular td</td>
  <td>regular td</td>
</tr>
<tr>
  <td colspan="3">content for the row</td>
</tr>

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

Pedestrian crossing Cordova experiences delayed response despite ontouchstart attempts to fix it

I have been experiencing a delay issue when using a CSS button with the ":active" pseudo-class on my phone. Every time I click the buttons, there is a noticeable delay before entering the active phase. Here is my CSS code: .btn {...} .btn:active{...} To ...

The font is not displaying properly in any browser, even though everything appears to be set up

Despite reading through all the relevant answers on various platforms, I am still unable to display my fonts properly. I have checked the paths, ensured that the files are in the correct location, and even tested a font squirrel example, but to no avail. ...

Analyze XML elements and retrieve their associated content

Analyzed below are the contents extracted from the processed XML file: <dblp> <incollection> ...

HTML Multi-Column List Box

Can a List Box be created with List Items displayed in Multiple Columns? I know there are other options available, but I'm curious if this is achievable using the <select> tag ...

Pictures not sizing properly within the grid layout

When attempting to create a simple grid with square images, I encountered an issue where the images were overlapping each other and appearing too large when directly placed inside the grid. In order to resolve this problem, I explored using CSS to adjust t ...

Tips for utilizing conditional CSS effectively in CakePHP 2.x

I need help translating this code: <!--[if IE 7]> <link rel="stylesheet" type="text/css" href="css/ie7-style.css" /> <![endif]--> into CakePHP. Currently, I am using $this->Html->css('fileName') in the view file an ...

What could be causing my web app's position to shift when it's built for mobile devices?

I have developed a web app using Angular. Testing it with the Web Developer responsive tool in a browser shows that it works fine, but I am encountering position issues when building it for Android using Cordova. The issue arises particularly when I try t ...

Create a search bar using HTML and CSS that utilizes the GET method

My current challenge involves creating a search functionality using HTML based on the username entered, such as 'user'. Upon clicking the search bar, the page should redirect to http://localhost/searchuser/user I am encountering difficulties wi ...

How come my webpage is not loading properly with CSS applied?

My website can be found at: www.rootscope.in While working on the CSS for my site, I encountered an issue with the following code: .loader { position: fixed; left: 0; top: 0; width: 100%; height: 100%; z-index: 9999; backgroun ...

My DIV is not floating to the right as expected. What could be the issue?

I'm having trouble positioning the timer to float on the right top side of the logo. Even though using the regular style="float:right" works perfectly... <div id="whole_page" /> <div id="header" /> <?php echo " ...

Expanding image size with CSS

Looking for assistance to fix the squished image in HTML & CSS. I used the CSS code provided by Figma to style the image in html, but it resulted in a different aspect ratio from the original picture, causing the image to appear squished. Any help is appr ...

Centered text in <td> with CSS aligned to the right

https://i.sstatic.net/UrB5f.jpg Is there a way to align the 3 input fields so that their right edges are all vertical? I still want the text+Input to be centered within the column but aligned vertically... Using Bootstrap 3.3.7 HTML: <link href="h ...

Interactive Query Box for Searching Key-Value Pairs

I'm interested in creating a customized search box for multiple GET queries using jQuery, JS, HTML and CSS. The user would first type something to prompt the red box to appear (key) and it would autofill with a default option based on what they typed. ...

Creating a Vertical Stack of Three Divs in ReactJS

Just Getting Started: As a newcomer to ReactJS and web development in general, I've put effort into researching my question without success. I acknowledge that the solution might be simpler than I think, so I apologize in advance if it turns out to b ...

Is there a way to modify the color scheme of my webpage while utilizing Bootstrap?

As I delve into programming with Bootstrap, I encountered an issue while attempting to change the background color of my body. Even though I used the following CSS code: body { background-color: #eba; width: 100%; height: 100%; } The color change ...

What is the best way to customize the Bootstrap CSS for an <a> element?

I recently started a blog and wanted to streamline my design process by using Bootstrap to avoid having to deal with media queries. However, I encountered an issue where the <a> element was displaying as blue. I have another CSS file that is loaded a ...

Animate a DIV to the bottom of the page, then with another click, animate it back to the top

I've been working on a div animation where the original position of the div from the top is set at 70% and the div itself is set as absolute. However, when I click on a button, it slides to the bottom of the page with a top value of 95%. Now, my goal ...

Align the text to the right within a display flex container

Below is the code snippet: <div className="listContent"> <div> <div className="titleAndCounterBox"> <div className="headerListTitle">{list.name}</div><br /> <div ...

Unexpected border-bottom styling issue observed on adjacent div elements

This is my unique code: <!DOCTYPE html> <html> <head> <style> </style> </head> <body> <div style="border-bottom:1px solid black"> <div style="width=50%;float:left">A new paragraph with u ...

Sending the selected option from a dropdown menu to populate a textbox on a separate webpage using PHP, jQuery, and AJAX

I am looking to dynamically update the value of a dropdown in index.php to a textbox in test.php using Ajax. The scenario involves having test.php embedded as an iframe within index.php. Upon changing the dropdown selection, the corresponding value should ...