html - 在单元格中拟合图像

标签 html css image

如何使图像适合单元格? 我想把整个图像放在黄色部分

下面是我的代码。

<!--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 -->

最佳答案

在 CSS 中设置宽度时,您必须指定一个单位。因此,您需要使用 width: 200px 而不是 width: 200px 代表像素。

或者,您可以尝试将图像宽度设置为 100%

关于html - 在单元格中拟合图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59638648/

相关文章:

css - 有没有办法为特定设备的宽度和高度设置媒体查询?

html - 如何移动图片下方的文字?

php - 餐厅菜单的数据库设计

javascript - 如何使用javascript在localstorage中存储带有文本和图像的li

html - 绕轴旋转立方体

javascript - 用 x% 宽的颜色填充表格单元格

image - r- 如何在 image.plot 中编辑 x 轴上的元素

c++ - opencl clCreateImage clCreateImage2D

html - CSS 菜单有问题

jquery - 如果有另一个div,如何在底部制作一个div?