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

Breaking the line within a text area field

Currently, I am working on a PHP form that includes a textarea where users can input data. This data is sent to the script using $_POST and then stored in a database. One issue I have encountered is that if a user populates the textarea but does not press ...

Align elements on the left side with some space between them

Having trouble displaying a list of images inline within a div. When I float them left, they leave a lot of space and do not display properly. Can anyone help me with this issue? See screenshot below: Here is my html code: <div class="col75"> & ...

Is it possible for CSS div to have a height of 100% when placed within fluid parents

When the parent div's height is set to 100%, you can also set the child to 100% and it will function correctly. However, if the parent's height is determined by its content, the height attribute does not work as expected. Are there any effective ...

Update: "Mui V5 - Eliminate collapse/expand icons in TreeView and reduce TreeItem indentation"

My current project involves Mui V5 and I am looking to customize the TreeView component. Specifically, I need to remove the collapse/expand icons as I want them to be integrated into the TreeItem label component on the left side instead of the right. Add ...

In Internet Explorer 8, the Radmenu hover menu may appear below surrounding Radmenus

Utilizing a radmenu, I am able to dynamically generate a submenu structure by examining folders in sharepoint document libraries. However, when placing multiple controls on the page, the root menu from other controls overlaps with the submenu of the curren ...

Retrieving data from a Ruby class based on a specific condition

Currently, I have a code snippet that adjusts the formatting of an editing page based on the number of values a question contains. <% (<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="aa9b8484eadbdfcfec8cdcac3c5c484dbc6ece0 ...

CSS with a "true" space for a fixed element (ensuring the previous element does not overlap with the current fixed element)

I am facing an issue with the layout of my webpage. I have two horizontal columns - the left one is fixed, along with a bottom footer that is below the second content column. When I add a border to the content column, it extends all the way down to the fo ...

The seamless flow of web design

Seeking guidance on creating a responsive web page. I have a functional website that looks great on my 13" MacBook, but encounters distortion at different screen sizes. What steps are necessary to ensure it appears crisp and appealing on any device? Should ...

Responsive design with Bootstrap grids

In the current 3 column layout, as the browser window size decreases, the columns stack in the order of first, second, and third. However, I want the behavior to change so that when the columns get smaller, they stack in a different order. First - This ...

Center the text vertically within a card using Vuetify styling

I am seeking a way to vertically align text within a card using Vuetify or traditional CSS in a Vue project. Here is my code: <template> <div> <v-container class="my-5"> <v-row justify="space-between"> <v- ...

Rotate each row of the table in sequence with a pause between each flip

I have a table with 3 columns and 10 rows. I would like to flip each row one by one, where each row contains data on both the front and back sides. The flipping animation should be similar to the example provided in this link, but the flipping should sta ...

Unable to display image on HTML page in Sails JS

In my current project, I am utilizing Sails Js and Mongo DB for development. When a user uploads an image and content for a blog post, I store it in the images folder and save the file destination along with the content to MongoDB. My goal is to display bo ...

Tips for managing responsive font sizes as screen size decreases

Hey there, I could really use some assistance with a new website I've been working on. While I have experience building Joomla sites for the past 6 months, this is my first attempt at making a responsive site using media queries. You can check out th ...

Creating a mobile-friendly layout with 3 columns: Tips and tricks

I attempted to solve the issue independently but didn't have much success. My goal is to create a proper version for mobile users using bootstrap, however, it currently looks terrible on mobile devices. I suspect the problem lies with the div classes ...

Using jQuery to create a dynamic fullscreen background image that responds to mouse movement

I am currently working on creating a dynamic full screen background that responds to the movement of the mouse. The idea is that as you move the mouse around, the background image will shift accordingly. For instance, if you were to move the mouse to the ...

The focusable attribute in SVG is malfunctioning

I've utilized the focusable attribute to ensure SVG elements receive focus within an HTML document. My goal is to navigate through SVG elements in the SVG tag using the TAB key, as indicated in this resource (http://www.w3.org/TR/SVGTiny12/interact.h ...

Is there an alternative to using CSS units of measurement when using the .css() method?

Is there a way to use .scrollTop() and .css() to adjust the margins of an element so that it floats up only when the page is scrolled, but stops at a certain margin value? I want the element to float between specific values while scrolling. The issue I am ...

Why isn't the background color displaying for the child text element during animation?

My search boxes are arranged in a grid layout with the use of the display: grid property. When I click on or focus on the <input type="text"> elements in column 1, the text elements within the <span> tag with class names placeholder2, ...

Only send file input to the server when it is changed, and disregard any other inputs until the form is submitted

I am working with a form structured like this: <form method="post" action=""> <input type="text" onchange="uploadFile()" name="username"> <textarea name="description">< ...

Updating the CSS link href in ASP.NET using code behind

I'm struggling with changing the CSS href in the code-behind of my .ASPX page. I've tried various methods but haven't found a solution that works as intended. HTML Markup: <link id="linkCSS" runat="server" href='/css/1.css' re ...