How to add style only under certain conditions?
I'm working on a div that has a max-height and content keeps getting added to it. The div grows as more content gets added but when it reaches the max height, it stops growing and acquires a scroll bar.
At that point, I'd like to add a border to the div to give the impression that the content continues below the bottom border.
Here is a very simplified version of the code:
<html>
<head>
<style>
.will-get-border {
/* border: 1px solid black; // <-- only if height >= 100px */
max-height: 100px;
overflow: auto;
}
</style>
<script>
function AddListItem() {
var ul = document.getElementById('unorderedList');
var li = document.createElement('li');
li.innerHTML = 'This is a list item.';
ul.appendChild(li);
}
</script>
</head>
<body>
<div class="will-get-border">
<ul id="unorderedList"></ul>
</div>
<input type="button" onclick="AddListItem()" value="Add list item" />
</body>
</html>
Would I need SASS or LESS for something like this?