Html 如何调整网页中图像的大小?

Html 如何调整网页中图像的大小?,html,css,firebase,Html,Css,Firebase,我已从firebase数据库检索到图像URL,但当我试图在网页上显示检索到的图像时,图像的大小并没有根据我在主体标记中提供的规范进行调整。获取的图像覆盖了网页的整个背景 JS HTML 让我们试试这个:您可以在javascript中修改高度和宽度 在html文件中,向图像标记添加id,如下所示 在javascript文件中,添加var image=document.getElementById'my_image'; image.height='125'; image.width='125'; 谢

我已从firebase数据库检索到图像URL,但当我试图在网页上显示检索到的图像时,图像的大小并没有根据我在主体标记中提供的规范进行调整。获取的图像覆盖了网页的整个背景

JS

HTML


让我们试试这个:

您可以在javascript中修改高度和宽度

在html文件中,向图像标记添加id,如下所示 在javascript文件中,添加var image=document.getElementById'my_image'; image.height='125'; image.width='125';
谢谢你的快速回复。但是没有效果。你的图片的html是什么?图片的html是我已经检查了stackoverflow上的其他答案,并尝试了相同的答案,但对我来说没有效果。
var myParam=location.search.split('itemKey=')[1];
alert(myParam);
firebase.database().ref('/Sell_Products/'+myParam).once('value').then(function(snapshot)
{var name=snapshot.child('name').val();
alert(name);
var image=snapshot.child('image').val();
var category=snapshot.child('category').val();
var description=snapshot.child('description').val();
var price=snapshot.child('price').val();
document.querySelector('img').src = image;
});
<img height="125" width="125"/>