Luckily, there is already the possibility of applying CSS rules based on the width of an element, check it out on the MDN website.