Having difficulty with the presentation of two images in one cell of an HTML table

Currently, I am working with an html table where I want to display two images in one cell. However, the issue I am facing is that both images are appearing together due to the styling applied so far. Is there a way for me to add a space in between the two images?

.text-content {
  text-align: justify;
  font-weight: bold;
  font-size: 10pt;
}

.text-title {
  text-align: center;
  font-weight: bold;
  font-size: 12pt;
  color: #000;
}

.thubnail img {
  float: left;
  max-width: 50%;
  box-sizing: border-box;
}
  <table border="1">
    <thead>
      <tr>
        <td width="8%">Item</td>
        <td width="8%">Quantity</td>
        <td width="10%">Size</td>
        <td width="50%">Description</td>
        <td width="10%">P/U</td>
        <td width="14%">Total ($.)</td>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td width="8%" rowspan="2" class="text-content">1</td>
        <td width="8%" rowspan="2" class="text-content">3</td>
        <td width="10%" rowspan="2" class="text-content">12 x 6</td>
        <td width="50%" class="text-title">test description</td>
        <td width="10%" rowspan="2" class="text-content">2000</td>
        <td width="14%" rowspan="2" class="text-content">6000</td>
      </tr>
      <tr>
        <td rowspan="2" class="text-content">
          When it comes to adding a space in between two images within the same cell of an html table, Lorem ipsum dolor sit amet consectetur adipiscing elit dignissim, volutpat sapien tellus cubilia mollis sollicitudin nibh nisi curabitur, nullam semper mi duis erat pellentesque nunc. Quis cursus vulputate auctor habitant quisque nibh facilisi vivamus rutrum cubilia, cras dignissim suspendisse vel condimentum lectus cum mauris integer, aenean luctus augue vitae vestibulum quam ac purus parturient.
          <div class="thubnail">
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/77020/desmond.jpg" alt="Desmond">
          </div>
          <div class="thubnail">
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/77020/desmond.jpg" alt="Desmond">
          </div>
        </td>
      </tr>
    </tbody>
</table>

Answer №1

Implementing flexbox is a viable option.

.text-content {
  text-align: justify;
  font-weight: bold;
  font-size: 10pt;
}

.text-title {
  text-align: center;
  font-weight: bold;
  font-size: 12pt;
  color: #000;
}

.thubnail {
  display: flex;
  justify-content: space-between;
}

.thubnail img {
  flex: 0 1 49%;
  max-width: 200px;
}
<table border="1">
  <thead>
    <tr>
      <td width="8%">Item</td>
      <td width="8%">Quantity</td>
      <td width="10%">Size</td>
      <td width="50%">Description</td>
      <td width="10%">P/U</td>
      <td width="14%">Total ($.)</td>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td width="8%" rowspan="2" class="text-content">1</td>
      <td width="8%" rowspan="2" class="text-content">3</td>
      <td width="10%" rowspan="2" class="text-content">12 x 6</td>
      <td width="50%" class="text-title">test description</td>
      <td width="10%" rowspan="2" class="text-content">2000</td>
      <td width="14%" rowspan="2" class="text-content">6000</td>
    </tr>
    <tr>
      <td rowspan="2" class="text-content">
        Lorem ipsum dolor sit amet consectetur adipiscing elit dignissim, volutpat sapien tellus cubilia mollis sollicitudin nibh nisi curabitur, nullam semper mi duis erat pellentesque nunc. Quis cursus vulputate auctor habitant quisque nibh facilisi vivamus
        rutrum cubilia, cras dignissim suspendisse vel condimentum lectus cum mauris integer, aenean luctus augue vitae vestibulum quam ac purus parturient.
        <div class="thubnail">
          <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/77020/desmond.jpg" alt="Desmond">
          <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/77020/desmond.jpg" alt="Desmond">
        </div>
      </td>
    </tr>
  </tbody>
</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

Using HTML5 input type number along with a regular expression pattern

In order to display only numbers and forward slashes in the input field with regex pattern, I attempted the following code: <input type="number" pattern="[0-9\/]*"> However, this code only shows the number pad from 0 to 9. How can I modify the ...

Strange issue with Firefox when utilizing disabled attribute as "disabled"

I found a curious bug in Firefox: Check out (unfortunately not reproducible in jsfiddle) <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> < ...

What is the correlation between statistics and posts that are generated dynamically?

One interesting aspect to consider is how statistics are connected to individual posts. For instance, linking the like count to each Facebook post or tying upvote and downvote stats to a question on Stackoverflow presents some intriguing challenges. How ...

Utilize HTML layout with Express.js framework

Recently delving into NodeJs, I managed to craft a single HTML page complete with Header and Footer. My next task is to utilize this as the main layout for other HTML pages without resorting to Jade. Is it possible to define and implement layouts using H ...

Calculating the time difference between the current datetime and a value retrieved from

I am having trouble calculating the difference between the current date and a date stored in my database. My goal is to display an expiry date message if the difference is 30 days. Here is the code snippet I currently have: var timeDifference = DateTime.N ...

Employing HTML and CSS to restrict the number of characters in sentences

Extracting a few sentences from a JSON file and displaying it in a <p> tag. <p> Thank you all for another wonderful night spent together this past Sunday at The Hippodrome in Baltimore. Thank yo... <p> I want to f ...

Challenges arise when creating a complementary php script for a natural language form

I'm a beginner at this and all the PHP I've tried hasn't been successful. I've come across examples of Natural Language forms, but none with functional PHP. While I am familiar with PHP in traditional forms, integrating the two has been ...

What is the reasoning behind jQuery UI employing CSS classes as opposed to pseudo-classes?

In this detailed explanation found on this website, it is discussed why jQuery UI uses CSS classes like .ui-state-active that are applied through JavaScript, rather than utilizing existing CSS pseudo-classes like :active. What is the reasoning behind thi ...

Unforeseen outcomes discovered by stacking one div over another, all without relying on z-index

My current project involves two stacked divs, each measuring 100px by 100px. The bottom div includes a black border on top, as shown in this example. <div id="top"></div> <div id="bottom"></div>​ div { width: 100px; height ...

Using unicode characters to style your Angular application

Hey there! I have an Angular 5 app on StackBlitz that implements table sorting. You can check it out here: https://stackblitz.com/edit/angular-rxdzom. The code for this app is based on the example from . In the app, I've used a stylesheet at ./app/sor ...

The dimensions of my textarea and input field are different

Just starting out with HTML and CSS here. I'm trying to use flexbox to create a form, but the width of my input fields and text area is off for some reason. Any ideas on what might be missing from my code? Thanks in advance! Here's the CSS I&apo ...

jQuery code runs smoothly on Firefox but encounters issues on Chrome

I'm experiencing an issue with a script that is supposed to post a comment and load the answer from a server. The script works fine in Firefox, but in Chrome, it seems that no event is triggered. You can click the button, but nothing happens. I'v ...

Develop a fresh AngularJS directive that utilizes the HTML5 audio element

Recently delved into Angular and managed to create audio buttons using an Angular directive: app.directive('soundButton', [function () { return { restrict: 'E', link: function (scope, element, attrs) { v ...

Creating impenetrable div elements with JavaScript or jQuery

I'm currently working on creating solid blocks using DIVs positioned side by side both horizontally and vertically. I've successfully achieved this when the divs have equal heights. However, an issue arises when a div has larger dimensions; it en ...

Tips for designing adjustable text in bootstrap 4

Could someone please assist me with making text responsive using Bootstrap 4? I have searched everywhere but it's strange to see that there are no tutorials on this topic. Below are my codes in case you would like to provide guidance. <div class=" ...

When using the <object> tag, it may not always render at 100% height as intended

Application Inquiry I am seeking assistance with a web page that features a title, and a sticky menu bar at the top, allowing the rest of the space for displaying content. When a menu item is clicked, the objective is to load a page in the content at full ...

Border for status input like on Facebook

I tried to investigate with Firebug, but struggled to find a solution. How does Facebook wrap the border around the autosize input in the status section? I am particularly curious about the small triangle attached to the border. While using Firebug, I loca ...

Techniques for dynamically displaying or hiding elements depending on various input groups using jQuery?

I am faced with a challenging task of handling multiple product forms on a single page. Each form contains various color options represented by radio buttons, each marked with either an available or unavailable attribute. My goal is to display a customize ...

Struggling with my HTML table styling

I attempted to construct the table below using two tables side by side, each with a width of 300, but due to the layout, when I attempt to create it as one table (which is my goal), the heights on the left and right become jumbled up because the cells on t ...

Why does changing the order of layers in Kinetic.JS affect the color of my shapes?

Currently experimenting with Kinetic.JS, I managed to create a UFO-like shape using two parts - a red hull and a grey disc. Check out the demo on JSBin My question is: why does the color of the disc change from grey to red when I rearrange the shape orde ...