Ways to format table using flex-wrap sans the use of flexbox

My HTML and CSS structure is as follows:

.item {
  background: white;
  padding: 5px;
  display: inline-block;
  text-align: center;
}
.item > div {
  background: yellow;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: table-cell;
  vertical-align: middle;
}
table{
  width: 100%;
}
<table>
    <tr>
        <td><div class="item"><div>0</div></div></td>
        <td><div class="item"><div>1</div></div></td>
        <td><div class="item"><div>2</div></div></td>
        <td><div class="item"><div>3</div></div></td>
        <td><div class="item"><div>4</div></div></td>
        <td><div class="item"><div>5</div></div></td>
        <td><div class="item"><div>6</div></div></td>
        <td><div class="item"><div>7</div></div></td>
        <td><div class="item"><div>8</div></div></td>
        <td><div class="item"><div>9</div></div></td>
        <td><div class="item"><div>10</div></div></td>
    </tr>
</table>

I am looking for a way to use flex-wrap: wrap on this table without using flexbox because I am working with an email template that does not support modern styling methods like flexbox or grid. I need to maintain the current table layout without causing any responsiveness issues.

Check out the current support of flex-wrap in emails here: doc

Answer №1

table{
 display:block}
table td{
display:inline-block;}
.item {
  background: white;
  padding: 5px;
  display: inline-block;
  text-align: center;
}
.item > div {
  background: yellow;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: table-cell;
  vertical-align: middle;
}
table{
  width: 100%;
}
<table>
    <tr>
        <td><div class="item"><div>0</div></div></td>
        <td><div class="item"><div>1</div></div></td>
        <td><div class="item"><div>2</div></div></td>
        <td><div class="item"><div>3</div></div></td>
        <td><div class="item"><div>4</div></div></td>
        <td><div class="item"><div>5</div></div></td>
        <td><div class="item"><div>6</div></div></td>
        <td><div class="item"><div>7</div></div></td>
        <td><div class="item"><div>8</div></div></td>
        <td><div class="item"><div>9</div></div></td>
        <td><div class="item"><div>10</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

Python for Asynchronous HTTP Requests

I am currently working on a Python script to extract the value of the href attribute from an anchor element on a web page. The challenge is that the div element containing the anchor element's content is loaded through AJAX jQuery calls when the web p ...

Prevent the crawling of HTML segments by utilizing HTML-XSL parsing techniques

I am currently working with Watson Explorer FC 11.0.2 and I am facing a challenge in excluding certain HTML tags from the Watson crawlers. I am using an XSLT parser to extract metadata, title, and body from an HTML page located at the following path: "/h ...

What is the best way to make jQuery not consider hidden elements?

Apologies for not sharing the code, as I know many of you prefer to see it. I am currently working on developing a comprehensive calculator for my small business, and I am aware that I am making several mistakes. I kindly request that you do not critique ...

While using Tcpdf, I encounter an issue where the textarea value I pass is not being printed in the desired format

Currently, I am experimenting with TCPDF to create PDF files from HTML. However, I have encountered an issue where passing a variable containing text results in the text being printed on separate pages for each line. Is there a way to ensure that the tex ...

What are some methods to achieve consistent alignment of input fields across different mobile devices using CSS?

I have been working on a login page that looks good on desktop and laptop devices. However, I am facing an issue with its display on mobile devices. The design appears differently on various mobile devices - for instance, it looks acceptable on an iPhone 1 ...

Vuetify vueJS dialog with elevated design

Is there a way to completely remove the elevation of a v-dialog so that it has no shadow at all? The elevation property in the v-dialog itself and using the class as Class = "elevation-0" have not worked for me. Here is the link to the component ...

Transmitting information compiled into an array format using AJAX and JQuery

I'm seeking assistance with sending my data efficiently. Previously, the script I developed served as a Mass Acknowledgments Tool for Nagios, drawing inspiration from components available for NagiosXI. Initially, the data processing and sending were ...

Guide to redirecting on click when utilizing an iframe

I needed to prevent the page from reloading before the action was complete by using an iframe. However, I encountered an issue where I needed the page to refresh after the action took place. I attempted two methods to achieve this - refreshing the page and ...

The link button became unresponsive as soon as I implemented CSS changes

I customized one of my buttons with special styling, and now I'm facing an issue where the button is clickable but it fails to direct me to the intended link (which should open a YouTube video in a new tab). #help { background-color: cornflowerbl ...

Turn an entire div into a clickable element with a functional :active CSS rule that is compatible with IE10

I am currently working on designing a clickable panel for an html app that will include multiple text elements and images. Based on my understanding, this is typically achieved using a div. An example of this would be: <div class="myButton"> &l ...

AmCharts Axis renderer mistakenly renders an additional grid line

I have successfully created a basic XYChart using amcharts4. To get rid of the grid lines on the x-axis, I changed the stroke opacity for the x-axis grid to 0 using the following code: xAxis.renderer.grid.template.strokeOpacity = 0; Everything was workin ...

Updating the color scheme of the selected nav-item and showcasing the corresponding page in relation to the navbar selection

I have been trying various methods, but I am unable to change the background color of an active navigation item and also display the corresponding page. Important: The jQuery code below successfully changes the background color of the navbar list item. Ho ...

Is there a way to prevent the contents of my div from overflowing beyond my other div?

Hey there! I'm fairly new to this whole web design thing, only a few months in. Currently, I'm in the process of creating a website for my school. However, I've hit a bit of a snag with different div containers holding various parts of my ...

Changing or toggling the visibility of links once the week is finished

I have a total of 4 links available, but I want to display only one link at a time, highlighting a different lunch option every week. Once all 4 weeks have passed, the first lunch menu will be shown again, starting from Monday. <div class="wrapper& ...

Broken image path in the Model-View-Controller framework

When using the jQuery DatePicker plugin in my MVC application, I face an issue with displaying a certain image for the Calendar pop-up. Here is the code snippet: $.datepicker.setDefaults({ showOn: "both", buttonImage: "../images/Calendar.png", ...

Is it possible to access forms and input fields in an AngularJS script without having to pass them from the HTML code?

Seeking a solution for input field validation, I have written code where input field states are passed from HTML to a script through a function. However, my goal is to directly retrieve the values in the script without passing them from the HTML when calli ...

Creating a seamless integration of images and backgrounds using CSS

Can you help me find a way to blend the image with the background to eliminate the visible separation between them? Here is the link to the image: https://i.stack.imgur.com/VB9in.jpg ...

Tips for resolving flickering animations in CSS and JavaScript

Is it possible to dynamically set a scale and margin for an element in order to center it fluidly using the wheel event? I am aiming to achieve a smooth transition while also adjusting scroll position on the wrapping element in a fluid manner. In the prov ...

How to create a captivating image effect using CSS on hover

I am attempting to create an animated image on hover. The desired outcome is similar to the one showcased here: Check it out (scroll to view the image "Our Team") Essentially, I want a background where I can showcase information such as names and links ju ...

My custom style sheet not taking precedence over Bootstrap styles

Using !important is something I try to avoid as much as possible. When I downloaded Bootstrap 3.0, I made sure to include the call to the .css file AFTER my core style sheet so that any changes I make to elements like .h1, h1{} take precedence over Bootstr ...