D
D
Dmitry Gormash2015-10-20 17:11:40
css
Dmitry Gormash, 2015-10-20 17:11:40

How to organize the ordered output of td in a table?

Good afternoon. There are two rows in the table tr1 , tr2 (Fig1). In these two lines, there are a certain number of td columns .
When reducing the screen, you need to make sure that tr1 , as it were, sticks together with tr2 , and it turns out, as in (Fig2).

The fact is that the script gives me a certain table structure, which cannot be changed in any way. All I can do is clean it up with the generated classes. Intervention in html is impossible. only css

16241996bbe04d159456c1ab2e158245.pngFig1
0d491ed0d3ed4241a0bda5a60794cb2a.pngFig2
p.s. I apologize in advance for the possibly incorrect wording of the question.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
G
GreatRash, 2015-10-20
@GreatRash

This is of course a mega-perversion, but you can use JS to throw all td into the first tr . Next in CSS write:

table, tr {
  display: block;
}

td {
  display: inline-block;
}

True, I don’t know how IE will react to such outrage, but all good browsers will swallow it.

N
Nikita Shultais, 2015-10-20
@shultais

For example like this

<!DOCTYPE html>
<html>
<head>
<style>
    .boxes {
         max-width: 400px;
    }
    .box {
        display: block;
        float: left;
        width: 80px;
        height: 80px;
        margin-right: 20px;
        margin-bottom: 20px;
    }
    
    .box-blue {
        background-color: blue;
    }
    
    .box-red {
        background-color: red;
    }
</style>
<body>
<div class="boxes">
  <div class="box box-blue"></div>
  <div class="box box-blue"></div>
  <div class="box box-blue"></div>
  <div class="box box-blue"></div>
  
  <div class="box box-red"></div>
  <div class="box box-red"></div>
  <div class="box box-red"></div>
  <div class="box box-red"></div>
</div>
</body>
</html>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question