.sub2 {
background-color: #FFFFBF;
margin-top: 30px;
height: 410px;
width: 100%;
}
h1.sub2 {
font: bold 100px american captain;
text-decoration: underline;
float: right;
}
p.sub2- {
font: italic 25px american captain;
margin-top: -300px;
margin-left: 750;
}
<div class="sub2">
<h1 class="sub2"> Mobile Phones </h1>
<img src="D:\ps\Notepad++\sub2.jpg" alt="Mobile Phones" style="width:47%;height:400px;">
</div>
The issue is that the image of mobile phones is not staying within the designated container named sub2. Even though the image is placed inside the <div>
tag of the container, it is still overflowing. Additionally, the heading "Mobile Phones" is not aligning to the right despite using the <float>
property on it. Any assistance in resolving this problem would be greatly appreciated.