What causes Safari to handle these table cells in such a distinct manner compared to Chrome and Firefox?

Exploring some basic HTML here. In Google Chrome (v57) and Firefox (v55), the two cells to the right have equal heights, while in Safari (v11) they do not. In Safari, the top cell adjusts to fit its content, leaving the remaining space for the bottom cell.

I'm wondering - is one of these outcomes correct and the other a glitch? Is there a simple solution to make Safari display the same results as Chrome (could it be due to browser styling differences)? I've examined it closely and can't find any discrepancies in user agent stylesheets.

img {
  max-width: 100%;
  display: block;
}

.image-cell {
  width: 150px;
}
<table border=1 cellspacing=0 cellpadding=0 bgcolor="#3faaed">
  <tr>
    <td rowspan="2" class="image-cell">
      <img src="http://www.rizwanashraf.com/wp-content/uploads/2009/04/gorgeous-chrysanthemum-3d-wallpaper.jpg" />
    </td>
    <td>Top Cell</td>
  </tr>
  <tr>
    <td>Bottom Cell</td>
  </tr>
</table>

There are countless ways to create an image with two equally sized boxes next to it - that's not the issue at hand. The question is about understanding the difference in behavior and whether we can apply simple styling to standardize them. This inquiry is educational; multiple layout options exist, but I'm focusing on this particular scenario.

Answer №1

The guidelines mentioned here are not clearly defined:

CSS 2.2 does not provide specific instructions on how row heights are calculated when cells span multiple rows, except that the combined height of all rows involved must be sufficient to contain the spanning cell.

This lack of definition implies that CSS does not specify how the height of a cell spanning multiple rows should be proportionally distributed among those rows.

In order to maintain consistent appearance for tables, it becomes challenging without specifying exact heights for either the entire table or individual rows. This task is nearly impossible with CSS table layout when dealing with images of unknown heights.

Answer №2

The rendering of table cells can vary depending on their content, leading to unpredictable display results. To achieve precise outcomes, it is important to specify dimensions.

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

Troubleshooting: EJ Syncfusion React Scheduler Issues

I have recently implemented a syncfusion calendar for managing appointments in my ReactJs project, following the code examples from this link . After editing the JS and CSS codes (available at ), I encountered an issue with the CSS not displaying correctl ...

Bootstrap: Altering grid column layout for medium and small/extra-small screens

Hello everyone, I'm having a bit of trouble working with Bootstrap. My goal is to create a container with a row that contains three columns of equal width: <div class="row"> <div class="col-md-4" style="background:red;">logo</div& ...

Display the changing value at the beginning of the drop-down menu

I'm currently working on an AngularJS forEach loop where I need to display a dropdown list with dynamic values. The goal is to have the value stored in $scope.showCurrentProgram as the first selected element in the dropdown list when the page loads, a ...

What is the best way to toggle the visibility of an element when clicked?

Is jquery the right choice for me? I am looking to toggle the visibility of the p element when clicking on the faq-q class. How does this functionality actually work? Here is a visual representation: https://i.sstatic.net/n0GR1.png html https://i.ss ...

Struggling to choose between PHP and jQuery for handling GET requests

I've been attempting to pass two variables from an HTML page to a PHP script, but I'm consistently receiving a response in text/html format. Essentially, the entire PHP code is being returned to the console. Here's the jQuery code I'm ...

Choose a tag using $(this)

Here is the code snippet I am working with: $("#accordian h3").click(function(){ $("#accordian ul ul").slideUp(); if(!$(this).next().is(":visible")) { $(this).next().slideDown(); ...

Customizing badge colors in Bootstrap using data from MySQL

Is it possible to dynamically change the color of Bootstrap badges based on MySQL data using PHP only? For example, if I have a column with 'status = 1', which is a TINYINT datatype and can have one of three different status values, I want each ...

Finding your way to a particular section within a webpage through an external source

Hey there! I'm currently working on creating a link that will direct users to a specific section within my webpage. For example, redirecting them to https://blabla.github.io/my-website. My code is quite straightforward and it functions properly when ...

Making sure all items in the top row of Flexbox columns have the same height

Within my flex wrapper, I have multiple column components with various flex items inside. Each column displays content adjacent to each other. The challenge is to ensure that the top item in each column has an equal height, creating a row-like effect. I&a ...

Generating dynamic paragraph numbers with HTML and JavaScript

I am currently working on a list where elements can be dynamically added using JavaScript with the following code: function getMovementButtons(size, articleId, articleTitle, articleType){ var lowerArticleType = articleType.toLowerCase(); var html = ...

Ways to access real HTML components within a Chrome extension instead of the initial source code

I am currently developing a Chrome extension, When using Chrome's Inspect Elements panel, all HTML page elements are displayed at the bottom. Is there a way to retrieve all those elements using JavaScript? The original source code of the page does ...

Having trouble understanding how to display an HTML file using Next.JS?

Currently, I am working on a project that involves utilizing Next.JS to develop a webpage. The main goal is to display a PDF file on the left side of the screen while integrating Chaindesk on the right side to create a chat bot capable of extracting inform ...

What could be causing my divs to overlap?

I recently started coding and I'm facing an issue with my <header> and <section> divs overlapping each other. I was under the impression that being block elements, <section> should be displayed below <header>. Any suggestions o ...

ParcelJs is having trouble resolving the service_worker path when building the web extension manifest v3

Currently, I am in the process of developing a cross-browser extension. One obstacle I have encountered is that Firefox does not yet support service workers, which are essential for Chrome. As a result, I conducted some tests in Chrome only to discover tha ...

Using div tags as interactive buttons, as well as incorporating dynamic functionality such as delete and report spam options

In this practice test scenario, the objective is to log in to Gmail, click on all checkboxes in a dynamic web table, and delete the mails. Below is the code that I have created for this task. The issue arises when checking if the delete button is visible. ...

Bootstrap grid: Preventing horizontal scrolling when all columns cannot fit in a single row

Why is it that when the column does not fit in one row, instead of showing a horizontal scrollbar, it goes to the bottom? <div class="container-fluid main-container" style="overflow-x: auto; width:600px"> <div class="row mx-5"> < ...

Assertion error: 1 does not match the expected value of 6

I am faced with a challenging test that requires me to write code that will pass successfully. However, no matter what I try, all I get is the following error messages: "Failed asserting that 1 matches expected 6" when I return 6 and "Too few arguments t ...

Older versions of Firefox are unable to detect a link that has been registered by the Vue event handler

Here is the HTML code that I am working with: <button id="btncontinue" ref="btncontinue" v-on:click="oncontinueclick" v-show="continuevisible"> <i class="fa fa-arrow-alt-circle-right fa-2x continue-icon" v-show="continuevisible"></i> &l ...

What is the best way to ensure that a grid header row stays aligned with the rows that scroll below it

Utilizing the Grid layout feature of bootstrap, I crafted an overview where one row acts as a header that should remain fixed at the top of the grid under all circumstances. The issue arises when the scrollbar appears, causing the layout to shift in a way ...

Ways to troubleshoot when a value does not get inserted into the database through ajax

I am facing an issue where my form data value is not being inserted into my database after submission. Prior to this, I successfully set the post data using ajax with ckEditor, but encountered errors from different inputs thereafter. The specific error mes ...