Is there any way in CSS to detect if a textarea has a scrollbar (vertical or otherwise) ?
textarea:has(:scrollbar-shown)
I am checking for latest modern browser versions only.
Is there any way in CSS to detect if a textarea has a scrollbar (vertical or otherwise) ?
textarea:has(:scrollbar-shown)
I am checking for latest modern browser versions only.
You can use the JavaScript to do that,
const textArea = document.querySelector("textarea");
if (textArea.clientHeight < textArea.scrollHeight){
console.log("The element has a vertical scrollbar!")}
else {
console.log("The element doesn't have a vertical scrollbar.")}