I have a number of sequences. Each sequence have a name and an array of characters. I have to order the characters vertical aligned:
sequence1 AGCAGTAGACAGTAGTACGTACGATAGCTCGACTAGCA
sequence2 GCGTAGCTCAGCTTCGATCCGATCGATATAAAGCTAGA
sequence3 GCTTCGGAGCGGCTAGCTAGAGATAGCCGATCGATCGA
If the character arrays becomes longer (or the visible space is small), line breaks occurs and i want the following display:
sequence1 AGCAGTAGACAGTAGTACGTACGATAGCTCGACTAGCA
sequence2 GCGTAGCTCAGCTTCGATCCGATCGATATAAAGCTAGA
sequence3 GCTTCGGAGCGGCTAGCTAGAGATAGCCGATCGATCGA
sequence1 GGATTAGCTAGCTAGACTACGGATCGA
sequence2 GGAGGATCGGCTTCGATCGATTCTTAG
sequence3 GGCATTTAGGGGGATTATATTTCTCTA
The length of sequences can be very high. It is neccessary to repeat the sequence names.
How can i achieve that?
.container {
display: flex;
flex-direction: row;
flex-wrap: wrap;
}
.stack {
display: flex;
flex-direction: column;
font-family: courier;
font-weight: bold;
font-size: 24px;
}
<div class="container">
<div class="stack">
<div>Sequenz1</div>
<div>Sequenz2</div>
<div>Sequenz3</div>
</div>
<div class="stack">
<div>a</div>
<div>t</div>
<div>g</div>
</div>
<div class="stack">
<div>c</div>
<div>g</div>
<div>h</div>
</div>
<div class="stack">
<div>a</div>
<div>c</div>
<div>a</div>
</div>
<div class="stack">
<div>t</div>
<div>a</div>
<div>t</div>
</div>
<div class="stack">
<div>a</div>
<div>t</div>
<div>c</div>
</div>
<div class="stack">
<div>c</div>
<div>g</div>
<div>g</div>
</div>
<div class="stack">
<div>a</div>
<div>c</div>
<div>a</div>
</div>
<div class="stack">
<div>t</div>
<div>a</div>
<div>t</div>
</div>
<div class="stack">
<div>a</div>
<div>c</div>
<div>c</div>
</div>
<div class="stack">
<div>g</div>
<div>g</div>
<div>t</div>
</div>
<div class="stack">
<div>a</div>
<div>a</div>
<div>t</div>
</div>
<div class="stack">
<div>t</div>
<div>t</div>
<div>c</div>
</div>
<div class="stack">
<div>c</div>
<div>c</div>
<div>g</div>
</div>
<div class="stack">
<div>t</div>
<div>g</div>
<div>a</div>
</div>
<div class="stack">
<div>a</div>
<div>a</div>
<div>t</div>
</div>
<div class="stack">
<div>g</div>
<div>t</div>
<div>t</div>
</div>
<div class="stack">
<div>c</div>
<div>c</div>
<div>t</div>
</div>
<div class="stack">
<div>t</div>
<div>g</div>
<div>c</div>
</div>
<div class="stack">
<div>a</div>
<div>g</div>
<div>t</div>
</div>
<div class="stack">
<div>g</div>
<div>t</div>
<div>a</div>
</div>
<div class="stack">
<div>c</div>
<div>c</div>
<div>g</div>
</div>
<div class="stack">
<div>t</div>
<div>g</div>
<div>g</div>
</div>
<div class="stack">
<div>a</div>
<div>a</div>
<div>a</div>
</div>
<div class="stack">
<div>c</div>
<div>t</div>
<div>t</div>
</div>
<div class="stack">
<div>g</div>
<div>c</div>
<div>c</div>
</div>
<div class="stack">
<div>a</div>
<div>t</div>
<div>t</div>
</div>
<div class="stack">
<div>g</div>
<div>a</div>
<div>t</div>
</div>
<div class="stack">
<div>c</div>
<div>t</div>
<div>a</div>
</div>
<div class="stack">
<div>t</div>
<div>t</div>
<div>g</div>
</div>
<div class="stack">
<div>g</div>
<div>c</div>
<div>c</div>
</div>
<div class="stack">
<div>t</div>
<div>g</div>
<div>t</div>
</div>
<div class="stack">
<div>a</div>
<div>a</div>
<div>a</div>
</div>
<div class="stack">
<div>c</div>
<div>t</div>
<div>g</div>
</div>
<div class="stack">
<div>g</div>
<div>c</div>
<div>c</div>
</div>
<div class="stack">
<div>t</div>
<div>t</div>
<div>t</div>
</div>
<div class="stack">
<div>a</div>
<div>a</div>
<div>a</div>
</div>
<div class="stack">
<div>g</div>
<div>g</div>
<div>g</div>
</div>
<div class="stack">
<div>t</div>
<div>c</div>
<div>c</div>
</div>
<div class="stack">
<div>c</div>
<div>t</div>
<div>t</div>
</div>
<div class="stack">
<div>g</div>
<div>t</div>
<div>a</div>
</div>
<div class="stack">
<div>a</div>
<div>a</div>
<div>g</div>
</div>
<div class="stack">
<div>g</div>
<div>g</div>
<div>t</div>
</div>
<div class="stack">
<div>c</div>
<div>c</div>
<div>t</div>
</div>
<div class="stack">
<div>t</div>
<div>t</div>
<div>c</div>
</div>
<div class="stack">
<div>a</div>
<div>a</div>
<div>g</div>
</div>
<div class="stack">
<div>c</div>
<div>g</div>
<div>a</div>
</div>
<div class="stack">
<div>t</div>
<div>c</div>
<div>t</div>
</div>
<div class="stack">
<div>a</div>
<div>t</div>
<div>t</div>
</div>
<div class="stack">
<div> </div>
<div>a</div>
<div>t</div>
</div>
<div class="stack">
<div> </div>
<div>c</div>
<div>a</div>
</div>
<div class="stack">
<div> </div>
<div>g</div>
<div>a</div>
</div>
<div class="stack">
<div> </div>
<div> </div>
<div>a</div>
</div>
</div>
If I resize the window. Flex wraps like expected. But I need the names again.
2
Answers
write your sequence name in :before class using some data attribute
then you can repeat the name in each flex just to try
To get a fully scalable system I think you’d need JS, but here is a CSS/HTML only method which repeats the labels using text-shadows, having separated them out from the text strings using grid.
And I guess if this is DNA where you may have millions of characters it’s not going to be very practical.
Given here more as a fun demo for anyone who has a less huge problem.