So I have a matrix of divs within a container in my page, each div displays either a '1' or a '0'.
If I set my container to a width of 100% and height to fit the bottom of my page, I want to be able to scale all of the 1's and 0's inside the container's divs (the number of 0's and 1's will be a static number, lets go with 100 for the sake of this question) to always fit the container perfectly no matter what size the browser is resized to, so it fits the width and height of the container perfectly without any trailing white-space or elements that go off the page or trigger a scroll bar.
The goal is to make sure the fonts resize to fit within the container exactly, regardless of screen size (both height and width).
I have seen multiple similar questions on stack overflow, such as: JavaScript Scale Text to Fit in Fixed Div, but they all seem to scale a certain line of text rather than the text from my combined divs. Is there a way I can do this within JavaScript?
If you see what is being asked for in This Question, this is exactly what I want. The difference in that Q is that he uses some text within 1 div rather than multiple to fit his container.
Here is my HTML:
<div id="binaryMatrix" style="width: 100%; height: 100%;">
<div>0</div>
<div>1</div>
<div>0</div>
<div>1</div>
<div>0</div>
<div>1</div>
<div>0</div>
<div>1</div>
...up to 100
</div>
Here is my CSS:
#binaryMatrix div {
float: left;
}
See Fiddle: Fiddle
This project is also on GitHub: GitHub - danjonescidtrix/binary-matrix
Any help or advice here is appreciated, thank you in advance