I have a div to which random words are distributed by lot. To display these words I use this script:
<script src="jquery.fittext.js"></script>
<script type="text/javascript">
$("#my_random_word").fitText(0.6);
</script>
The problem is that when my word is longer than 10 letters is too wide for the screen and instead of resizing, it just overflows the screen's width. CSS:
#parent_of_my_random_word {
display: table;
position: absolute;
height: 100%;
width: 100%;
text-align: center;
}
#my_random_word {
color: red;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
user-select: none;
}
Is there any way to specify another function for the words longer than 10 letters or what else can I do? Thanks.