I am struggling to place div under third td (7 under 6 on the screen). The div(7) should also change its Y position depending on td(6) height.
1, 2, 4, 5, 7 change its content dynamically (it can containt <sub>
& <sup>
tags) and text(6) should be aligned with the top of the 4 and 5 boxes.
If 6 is empty, then 7 should be on 6 place aligned top of 4 and 5 boxes. Boxes should be the same exact width and height as on the screen (4 - ~width: 200px;, 5 - ~width: 120px;).
- I tried to put that div inside the table, but it makes boxes ugly big.
- Also i tried to make table inside tr of the 6 element, it is also made boxes ugly.
- When you give the table
position absolute
, then the div does not change its position.
This is some complicated task i can't complete for a week already. I also tried to make rowspan
and third tr, to put 7 under 6, but rowspan makes boxes big as well (like it shown here).
It is allowed to change html code. It is important to make it through CSS, because it needed for printing. And one of the biggest problem when you try to solve it with JS, is when you zoom out a window, items can change it position.
.detailName {
margin-top: 10px;
}
.table-sources {
width: 400px;
margin-left: 40px;
margin-top: 3px;
}
.table-wrap:first-child {
margin-top: -10px;
}
.table-wrap {
display: flex;
}
.table-vals {
margin-bottom: 5px;
}
.table-vals th {
max-width: 200px;
text-align: left;
font-size: 13px !important;
font-weight: normal;
vertical-align: top;
}
.table-vals .first-th {
min-width: 200px;
}
.table-vals td {
text-align: center;
padding: 10px;
font-size: 20px;
font-weight: bold;
}
.table-vals .second-th {
float: left;
position: relative;
left: 15px;
width: 98px;
}
.table-vals .first-td {
border: 2px solid #192E7B;
}
.table-vals .second-td {
position: relative;
left: 15px;
background: wheat;
}
.table-vals .third-th {
position: relative;
left: 40px;
}
.table-vals .third-td {
font-size: 14px;
font-weight: normal;
position: relative;
left: 30px;
top: -20px;
text-align: left;
}
.source-link {
word-break: break-word;
font-size: 12px;
color: grey;
position: absolute;
width: 400px;
}
.detailName {
display: block;
}
.detailName {
font-weight: bold;
}
<div class="tables-wrap">
<div class="table-wrap">
<table class="table-vals">
<tbody>
<tr class="first-tr">
<th class="first-th">ipsum dolor</th>
<th class="second-th">ipsum dolor</th>
<th class="third-th">ipsum</th>
</tr>
<tr class="second-tr">
<td class="first-td">ipsum dolor</td>
<td class="second-td" style="background:rgb(123, 161, 196);color:white;">ipsum dolor</td>
<td class="third-td" style="/* top:-23px; */">Norddeutsches Tiefland</td>
</tr>
</tbody>
</table>
<div class="table-sources" style="position: relative; left: -120px; top: 31px;">
<span class="detailName">Ipsum dolor</span><span class="source-link">Ipsum dolor Ipsum dolor Ipsum dolor Ipsum dolor Ipsum dolor Ipsum dolor Ipsum dolor Ipsum dolor</span>
</div>
</div>
</div>