How can i avoid the <br> tag by media query in my Templete. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How can i avoid the <br> tag by media query in my Templete.

I have to use the <br> tag for my Desktop view but now i want to avoid the <br> tag for my mobile view. So how i do that? please help.

15th Oct 2018, 6:07 AM
Md. Rakib Ali
Md. Rakib Ali - avatar
1 Answer
0
Use javascript. check for window width first with window.innerWidth; if that's smaller than desktop let brTag = document.createElement("br"); Then get the tag you want with id and append the br tag to it. for example: let exDoc = document.getElementById("randomTag"); exDoc.appendChild(brTag); Hope this helps😅.
15th Oct 2018, 6:46 AM
Akib
Akib - avatar