Reputation: 61
Good morning, I am trying to put 2 images, side by side within a div.
I have tried float left and float right, but to no success.
It works on a separate HTML page, but not when I add it to my current page.
very strange, but a simple resolution, but cannot see it...
Thanks
#mikeimgs {
width:70%;
margin-top: 10px;
margin-right: auto;
margin-left: auto;
}
.img1 {
margin-top:10px;
float:left;
}
.img2 {
margin-top:10px;
float:right;
}
<div id="mikeimgs" class="fluid">
<div class="fluid img1"><img src="file:///G-DRIVE mobile USB/STR Website/STRv1/August 2016/Mike-Vittiimg.jpg" alt="" width="200" height="200"/></div><div class="fluid img2"><img src="file:///G-DRIVE mobile USB/STR Website/STRv1/August 2016/Odyssey250.jpg" alt="" width="200" height="200"/></div>
</div>
` with the page i'm trying to create.
Upvotes: 0
Views: 2599
Reputation: 750
The div containing the image should not have fluid class, additionally you do not need float left and float right, they both will be float left.
#mikeimgs {
width:70%;
margin-top: 10px;
}
.img {
margin-top:10px;
float:left;
width:200px;
}
<div id="mikeimgs" class="fluid">
<div class="img"><img src="file:///G-DRIVE mobile USB/STR Website/STRv1/August 2016/Mike-Vittiimg.jpg" alt="" width="200" height="200"/></div><div class="img"><img src="file:///G-DRIVE mobile USB/STR Website/STRv1/August 2016/Odyssey250.jpg" alt="" width="200" height="200"/></div>
</div>
Upvotes: 1
Reputation: 244
Your code as it stands seems to run fine here. However there's no CSS provided for the .fluid class. Is it possible that this class is overriding your expected outcome?
Upvotes: 0