After reviewing a specific post at , I find myself unsure of how to target a particular class for reference.
I am certain that I want to implement
document.onload = checkWidth();
window.onresize = checkWidth();
However, I am uncertain about the procedure to change the background of a div based on the screen size of the device or the current browser window size. Here is my current setup, with Bootstrap being used for CSS
<div class="row">
<div class="col-sm-6 background1 border-design">
<p>Placeholder</p>
</div>
</div>
regarding CSS
.background1 {
background: linear-gradient(100deg, #87CEFA 0%, #FF8C00 100%);
}
.background2 {
background: linear-gradient(100deg, #FF8C00 0%, #C0C0C0 100%);
}
Suppose I want the background to switch to .background1 when the browser window size is ≥576px (due to using col-sm-6), but switch to a different style, like .background2, when the browser window size is less than or equal to 576px.