Image -- Head first into HTML

How image works behind scene


1. Browsers treat <img> elements a little differently than other HTML elements; after reading the HTML page, the browser retrieves each image from the web server and displays it.


2. If you have more than a couple of large images on a web page, you can make your web page more usable and faster to download by creating thumbnails—small images that the user can click on to see the large version of the image.


3. A width of less than 800 pixels is a good rule of thumb for the size of photo images in a web page. Most photo images that are created by digital cameras are too large for web pages, so you’ll need to resize them.


4. Images that are too large for the browser make web pages difficult to use and slow to download and display.


5. Images can be used as links to other web pages. To create a link from an image, use the <img> element as the content of an <a> element, and put the link in the href attribute of the <a> element.







Use relative path 


Use URL




Always provide an alternative


Size up your images(if you don't add these attributes, the browser will decide it for you)


but the browser has to retrieve the entire large image before it scales it down to fit your page you can edit it before you load it


You could use the width and height attributes to resize an image, but that’s not a good idea. Why? Because if you do that,
you’re still downloading the full-size image, and making the browser do the work to resize the image (just like when you have
the auto resize option on in browsers that support that feature). The width and height attributes are really there to help the browser
figure out how much space to reserve for the image; if you use them, they should match the actual width and height of the image








评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值