在表格中显示时缩小图像(make the image smaller while displaying in a table)

编程入门 行业动态 更新时间:2024-10-27 19:15:31
表格中显示时缩小图像(make the image smaller while displaying in a table)

如何在html中以小尺寸显示图像

假设我以这种方式显示图像---

<td> <a href="//your link//"><img src="//image url//"></a> </td>

但是图像显示得如此之大,我如何控制图像大小并使其变小。

how to display image in a small size in html

Suppose i am displaying the images in this way ---

<td> <a href="//your link//"><img src="//image url//"></a> </td>

But the image is displaying so big, how can i control the image size and make it small.

最满意答案

简单地设置高度和宽度

<img height="120px" width="120px" src="{{ data.image_url }}">

但我相信最好的做法也是设置它,如果它被defined ,它应该显示其他default动作

<td> {% if data.image_url is defined %} <img height="120px" width="120px" src="{{ data.image_url }}"></a> {% else %} </td>{% endif %}

Set the height and width simply

<img height="120px" width="120px" src="{{ data.image_url }}">

But i belive the best practise will be also to set it like if it is defined than it should show else a default action

<td> {% if data.image_url is defined %} <img height="120px" width="120px" src="{{ data.image_url }}"></a> {% else %} </td>{% endif %}

更多推荐

本文发布于:2023-08-03 06:46:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1384099.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:表格   图像   image   table   displaying

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!