I'm learning responsive design and I wonder If I can swap an image in the header due to the viewport size? I can scale the image by using different settings of the width, like a 100% width when it's in a small viewport and have a width of 30% when the viewport is bigger. But I would also like to change to another image as well. Preciate some help to solve this!
HTML:
<header class="mainHeader">
<img src="img/logo.gif">
<nav>
<ul>
<li class="active"><a href="#">Home</a></li>
<li><a href="#">Portfolio</a></li>
<li><a href="#">About</a></li>
</ul>
</nav>
</header>
CSS normal:
.mainHeader img {
width: 30%;
height: auto;
margin: 2% 0;
}
CSS:
@media only screen and (min-width: 150px) and (max-width: 600px)
{
.body {
width: 90%;
font-size: 100%;
}
.mainHeader img {
width: 100%
}
}