Ng Wei Shen
Ng Wei Shen

Reputation: 75

Fitting the image in the cell

How do I fit the image in the cell? I want to fit the entire image in the yellow part

Below is my code.

<!--Top Part-->
<div style="width: 100%; display: table;">
<div style="display: table-row">
<div style="width: 770px; height:270px; display: table-cell; background-color:#B2BABB;">
<p style="font-family: Allerta Stencil; font-size:40px; color:red; padding-top: 65; 
padding-left:120;">SCOPE<br>Industries Berhad<br>
<span style="font-size:25px; color:black; font-family: Allan;">
A simple solution,<br></span>
<span style="font-size:25px; color:black; font-family: Allan; padding-left: 135;">
for a complex problem.</span></p>
</div>

<!-- Slideshow -->  
<div style="display: table-cell; background-color:#F7DC6F ">
<img src="123.jpg" style="width:200;">
</div>
<!-- Slideshow End -->

Upvotes: 0

Views: 47

Answers (3)

namdt55555
namdt55555

Reputation: 469

You can set this image is background of the div, and use "background-size: cover;"

Upvotes: -1

akhtarvahid
akhtarvahid

Reputation: 9769

If you have fixed your wrapper(root) element width then try to use width:100% for inside element like- for image tag so that i could adjust as per your devices width.

<img src="123.jpg" style="width:100%;">

Upvotes: 2

Pablo
Pablo

Reputation: 6048

When setting the width in CSS you must specify a unit. So instead of width: 200 you need to use width: 200px. The px stands for pixel.

Alternatively, you can try setting the image width to 100%.

Upvotes: 2

Related Questions