在网站中链接图片的正确方法是什么? [英] what is the correct way to link image in website?

查看:80
本文介绍了在网站中链接图片的正确方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

按照我的头衔,正确的方法是什么?
我已经看到它们都出现在网站中:

As per my title, what is the correct way? I have seen both of these appearing in websites:

<img alt="My image" height="60" src="http://www.website.com/images/myimage.png" width="80">

<img src="images/myimage.png" width="60" height="80" alt="my image"/>

每种类型的优点是什么?
与第二个相比,第一个可以帮助更快地加载图像吗?

What is the good of each type? Does the 1st one aids in faster loading of image as compared to the 2nd one?

谢谢。

推荐答案

第二个示例是相对URL。通常,当您不对URL等内容进行硬编码时,可伸缩性会更好。

The second example is a relative URL. In general, it's better for scalability when you don't hard-code things like URLs.

这篇关于在网站中链接图片的正确方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆