Changing the Height of Designated Rows in a Table using Bootstrap

Trying to work with Bootstrap v3 and a simple table, but struggling to adjust the height of specific rows in the table to be smaller than the rest. Adding a specific tr class doesn't seem to do the trick.

Here's the custom CSS I've attempted:

 <style type="text/css>
      tr.approvers {
        height:20px;
      }
    </style>

And here's the HTML table:

<tr>
<td>Acme Widgets</td>
<td>1</td>
<td class="success">Approved</td>
<td>001</td>
</tr>
<tr class="approvers">
<td></td>
<td>John Smith</td>
<td class="success" colspan="2">20/10/2015 14:24:24</td>
<td></td>
</tr>

Answer №1

For the code to work properly, you need to ensure that <tr> elements are wrapped inside a <table></table>. If tr is not within table, it will be considered invalid and the browser will not create the DOM tree for the rows. As a result, the browser will ignore all the <tr> and <td> elements, causing your code to be displayed as plain text.

tr.approvers {
  height: 60px;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.5/css/bootstrap.css" rel="stylesheet"/>
<table>
  <tr>
    <td>Acme Widgets</td>
    <td>1</td>
    <td class="success">Approved</td>
    <td>001</td>
  </tr>
  <tr class="approvers">
    <td></td>
    <td>John Smith</td>
    <td class="success" colspan="2">20/10/2015 14:24:24</td>
    <td></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

Personalized validation messages with jQuery

I am currently working on a contact form using jQuery, but I am facing challenges in displaying my custom validation messages. Instead of showing the message I specified, it only displays a small popup with the generic message: "Please fill in the form". I ...

Creating SQL statements in PHP programming

I am struggling to take all the values from the post array and incorporate each one into a select statement that updates the preceding value. My issue lies in executing this process in PHP due to difficulties with string escaping. This represents the SQL ...

What is the method for selecting an li element within a ul list using Selenium in Python?

My goal is to automate the process of clicking on 'National Data' on a specific website using the Selenium package in Python. The website I am referring to can be found at . Although I attempted to achieve this automation, I encountered difficul ...

Utilize JavaScript to randomly choose images as background tiles in HTML

Currently, I am in the process of developing a game using HTML/CSS/JavaScript. My background is currently set to a single image (100px / 100px) being repeated vertically and horizontally to tile across the entire page body; CSS: body { background-ima ...

Hey there, I'm looking to use different CSS fonts on Windows and Mac for the same page on a web application. Can someone please guide me on how to accomplish this?

In order to tailor the font based on the operating system, the following criteria should be followed: For Windows: "Segoe UI" For Mac: "SF Pro" Attempts have been made using the code provided below, but it seems to load before the DOM and lacks persisten ...

Position the text to the right in line with Bootstrap 4

I'm currently using bootstrap 4. I'm having trouble aligning text to the right on my card header. I tried applying the ml-auto class but it didn't have the desired effect. Can anyone suggest a solution? https://i.sstatic.net/yqLrp.jpg Here ...

Is there a way to use regular expressions to search for class names within nested div elements?

I'm struggling to find nested divs like these in my document object model (DOM) <div class="two-columns some-other-class"> <div class="two-columns some-other-class"> </div> </div> I attempted to search for neste ...

Creating visually appealing website designs with Firefox by implementing smooth background image transitions using Javascript with

Currently, I am facing an issue with the banner area on my website. The background of the banner is set to change every 10 seconds using JavaScript. However, there seems to be a flickering effect that occurs for a brief moment when the background-image is ...

Is it possible for Spring Boot to initiate an action that will dynamically update an image in an HTML document using JavaScript or another method?

I am currently facing a challenge in updating an image on a website built with HTML, while utilizing Spring Boot as the backend technology. As of now, I am using JavaScript to update the image at regular intervals, but the timing does not align with when t ...

The extent of a nameless function when used as a parameter

I am currently developing a straightforward application. Whenever a user hovers over an item in the list (li), the text color changes to green, and reverts back to black when the mouse moves away. Is it possible to replace lis[i] with this keyword in the ...

Any tips for avoiding a new line when generating html attribute values to prevent my json string from breaking?

When working with JSON string values in button element attributes, I have encountered an issue where a single quote causes the value to break and create newlines. For example: var $json = JSON.stringify('{"Long_text":"This is \'my json stri ...

Looking to modify the CSS of an element during a drop event using interact.js?

I've encountered an issue in my code where setAttribute and .transform are not working as expected. I have tried using them within the ondrop event function, but with no success. interact('.dropzone') .dropzone({ // Setting the r ...

Ensure that the spacing between rows matches the spacing between columns

I am working on creating a 3x3 grid using Bootstrap. My goal is to have consistent spacing between the rows and columns. How can I achieve this effectively? ...

jQuery can be used to automatically close a subnav when another subnav is opened

Currently, my code is almost perfect, but there is a slight issue with allowing multiple sub-navs to be open at the same time. I want to ensure that when one sub-nav is opened, any others automatically close. Essentially, in the jQuery code below, I need ...

"Internet Explorer naturally selects the submit button when users press the enter key to submit a

In my current application, I have implemented a form with a hidden button to address issues with the numeric keyboard on Android. Essentially, pressing enter or focusing on the invisible button will trigger form submission. Pressing enter works fine in Ch ...

Creating a webpage that loads directly to a specific section of content

After searching online, I couldn't find the solution I was looking for. My goal is to have the visible part of the page load halfway down the actual page. This way, when users visit the site, they can immediately scroll up to see more content. I hope ...

Display selected divs with dropdown box but show all divs when no option is chosen

I came across a helpful code on this website while working on my own website. After customizing it to my liking, I encountered some issues. My main goal is to have all divs displayed when no value is selected from the dropdown box. Below is the code that I ...

The Platform for Organizing my Content

In the process of creating a Content Management System (CMS), I am exploring different development options. Below is a link to an illustration of the CMS design I have in mind; Figure: Proposed CMS layout Can the entire system be developed using PHP&apo ...

What is the best way to dim the entire webpage when a popup appears?

I need help with changing the background of my sidebar to dark when clicked. I used this code, but the posts remain white and the dark background doesn't disappear when I close the sidebar. Can anyone suggest what I should do? Below is the HTML code s ...

What is the method to include a meta property with the value "og:locale"?

There have been multiple articles discussing how to properly add the meta og:locale. I want to know for sure which format is correct, is it 'en_US' or 'en-US'? Are they both valid? On my website, I added it using this format: <meta ...