I'm currently learning CSS and I am experimenting and I stumbled upon this difference in the output. So this is the code:
<html>
<body>
<link href="https://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">
<style>
.red-text {
color: red;
}
h2 {
font-family: Lobster, monospace;
}
p {
font-size: 16px;
font-family: monospace;
}
.smaller-image {
width: 100px;
}
.thick-green-border {
border-width: 10px;
border-color: green;
border-style: solid;
}
</style>
<h2 class="red-text">CatPhotoApp</h2>
<main>
<p class="red-text">Click here to view more <a href="#">cat photos</a>.
</p>
<a href="#"><div class="thick-green-border"><img class="smaller-image"
src="https://s3.amazonaws.com/freecodecamp/relaxing-cat.jpg" alt="A cute orange cat lying on
its back."></div></a>
</main>
</body>
</html>
However if I change this line:
<a href="#"><div class="thick-green-border"><img class="smaller-image"
src="https://s3.amazonaws.com/freecodecamp/relaxing-cat.jpg" alt="A cute orange cat lying on
its back."></div></a>
to this(just replacing the div with span):
<a href="#"><span class="thick-green-border"><img class="smaller-image"
src="https://s3.amazonaws.com/freecodecamp/relaxing-cat.jpg" alt="A cute orange cat lying on
its back."></span></a>
I get totally different output:
So can anybody explain me what's going on in the code?