I want to make this website mobile responsive. But when I add image with the text it breaks its size. I am trying to keep the image and text side by side. I can’t understand what should be the width and height.
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css">
<div class="row">
<div class="col-md-6">
<div class="box2">
<img src="http://lorempixel.com/160/140/" align="left">
<h3>PETER L.MARUZ </h3>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.Lorem Ipsum has been the industry's standard dummy text ever since the 1500s</p>
<img src="image/f.jpg" width="35" height="30">
<img src="image/twitter-bird-white-on-blue.jpg" width="35" height="30">
</div>
</div>
1:
4
Answers
Remove all the widths from main images and use ‘img-responsive’ class.
Since you are using bootstrap, try below
For icons you can use external styles
First, don’t use
width="..."
andheight="..."
in your HTML. If you want things to be responsive, you have to use CSS. Everything in the HTML is actually “hard coded” and not responsive at all.Second, if you fix both width and height, it changes the ratio. You can use
max-width
andmax-height
as presented here to fix that secondary problem.Play around with flexbox and media queries 🙂
View the snippet above in full-screen mode to see what the layout will look like when viewed on a higher resolution display. On the other hand, it appears that you are using bootstrap. It should provide you with enough flexbox utilities you’ll need for a responsive design.
Also, here’s a pen. The example I made doesn’t look like the layout you gave. But, it’ll give you an idea on how to achieve what you want 🙂
instead of using
alone will not help you, you have to use
also. Try using in
percentage
like :Percentage will auto adjust your image as per the screen.
But you have to hit and trial a lot to check the changes work on all screens properly.
Try playing with ‘Media Queries’ also if you got stuck with % at some points. If you have any further query you may comment.
If this answer helped you ticket RIGHT