[HTML5] Show Images of Differing Resolutions Depending on the Viewport Width with srcset
For small viewports, we want to save bandwidth and we may be dealing with slow speeds; so it's very important that images' filesizes are not too big. In this lesson, we are going to cover how to show a different-sized image than the one seen on desktop.
<!DOCTYPE html>
<html lang="en"> <head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, maximum-scale=1" />
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/marx/2.0.7/marx.min.css">
<link rel="stylesheet" href="style.css">
</head> <body>
<img
srcset="https://imgur.com/Nv96rWN.jpg 700w,
https://imgur.com/aJOEQVz.jpg 1024w"
sizes="(max-width: 480px) 90vw,
(max-width: 700px) 70vw,
60vw"
src="https://imgur.com/aJOEQVz.jpg"
alt="Opal lying on her new bed - my laptop case"
> </body> </html>
[HTML5] Show Images of Differing Resolutions Depending on the Viewport Width with srcset的更多相关文章
- [HTML5] Show Different Variations of Images Depending on the Viewport Width using Art Direction
For small viewports, we may want to show a variation of the desktop image. A very common use case of ...
- HTML5 Mobile 适应移动端的屏幕<meta name='viewport' content='xxxx'>
网页手机wap2.0网页的head里加入下面这条元标签,在移动端的浏览器中页面将以原始大小显示,并不允许缩放. 加入 如下代码 即可自适应移动端的屏幕: <meta name="vie ...
- 闲扯游戏编程之html5篇--山寨版《flappy bird》源码
新年新气象,最近事情不多,继续闲暇学习记点随笔,欢迎拍砖.之前的〈简单游戏学编程语言python篇〉写的比较幼稚和粗糙,且告一段落.开启新的一篇关于javascript+html5的从零开始的学习.仍 ...
- HTML5 之Canvas绘制太阳系
<!DOCTYPE html> <html> <head> <title>HTML5_Canvas_SolarSystem</title> ...
- HTML5应用之时钟
利用HTML5的Canvas API可以完成我们以前意想不到的动画效果,以前我们想在网页上放置一个时钟,需要先用flash工具制作一个钟表,并写上复杂的JavaScript代码,然后载入到页面中.而H ...
- web HTML5 调用摄像头的代码
最近公司要求做一个在线拍照的功能,具体代码如下: <html> <head> <title>html5调用摄像头拍照</title> <style ...
- html5移动web开发实战必读书记
原文 http://itindex.net/detail/50689-html5-移动-web 主题 HTML5 一.配置移动开发环境 1.各种仿真器.模拟器的下载安装 http://www.mob ...
- html5绘制折线图
html5绘制折线图详细代码 <html> <canvas id="a_canvas" width="1000" height="7 ...
- HTML5的在线视频播放方案
移动端H5音频与视频问题及解决方案 看下最后实际效果:兼容PC,iphone, 安卓5.0 解决了,手动,自动,不全屏的问题 左边视频代替了动画,然后支持背景蒙板效果,能够透出底图 右边是原视频文件 ...
随机推荐
- vue2.0的基本特性
本文目前总结的特性如下1.侦听属性和计算属性2.class的绑定3.条件渲染时的注意事项4.v-if和v-for同时使用的注意事项5.插槽6.ref,父组件调用子组件的另一种方式7.<keep- ...
- int long long 的范围
unsigned int 0-4294967295 (10位数,4e9) int -2147483648-2147483647 (10位 ...
- appium+python自动化-adb offline(5037端口被占)
前言 adb连手机的时候经常会出现offline的情况,一般杀掉adb,然后重启adb可以解决. 如果发现不管怎么重启adb都连不上,一直出现offlie的情况,这个时候很大可能就是adb的5037端 ...
- Jmeter性能指标分析-下载了服务器监控插件的各个组件的功能介绍
1.jp@gc - Actiive Threads Over Time:不同时间的活动用户数量展示(图表) 当前的时间间隔是1毫秒,在setting中可以设置时间间隔以及其他的参数 2.jp@gc - ...
- web项目架构
二
- NYOJ 104 最大和
最大和 时间限制:1000 ms | 内存限制:65535 KB 难度:5 描述 给定一个由整数组成二维矩阵(r*c),现在需要找出它的一个子矩阵,使得这个子矩阵内的所有元素之和最大,并把这个 ...
- A. Nearest Common Ancestors
A. Nearest Common Ancestors Time Limit: 1000ms Case Time Limit: 1000ms Memory Limit: 10000KB 64-bi ...
- 微软.net一些类的源码
地址:http://referencesource.microsoft.com/#mscorlib/system/collections/generic/dictionary.cs 关键字:refer ...
- [UOJ#129][BZOJ4197][Noi2015]寿司晚宴
[UOJ#129][BZOJ4197][Noi2015]寿司晚宴 试题描述 为了庆祝 NOI 的成功开幕,主办方为大家准备了一场寿司晚宴.小 G 和小 W 作为参加 NOI 的选手,也被邀请参加了寿司 ...
- 浅谈Oracle数据库分区表
Oracle数据库分区是作为Oracle数据库性能优化的一种重要的手段和方法,之前,只听过分区的大名,却总未用过,最近简单学习了一下,总结如下,不对之处,还希望朋友们多多指点,交流! 1.表空间及分区 ...