Is it possible to fill text based on window dimensions?
For example, I would like to do something like: fills the devils on the left side of the screen. If I want to resize windows then the number of rows of "example text" should be changed.
Unfortunately I do not have any code to show because I do not know how it will start. I think I have to use JS for this, but I'm not sure how JS needs to collect window dimensions.
Many thanks.
You can get the height of javascript with the window:
Var h = window.innerHeight;
If you know the line-height of "example text" (you can already put it in CSS or you get it with the document.getElementById ('div_name') .style.lineHyight
), then divide the window height by line-height. This should give you the number of rows that fit in the window.
Alternatively, in CSS, you div
to height: 100%
(assuming all the basic elements as 100% height) and then an inner div
to status: complete; Bottom: 0; Set
so that the text starts counting from the top. You do not have to choose the option to show the scrollbar, because the text will essentially exceed div
.
No comments:
Post a Comment