[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 解决了,手动,自动,不全屏的问题 左边视频代替了动画,然后支持背景蒙板效果,能够透出底图 右边是原视频文件 ...
随机推荐
- 对shell中cat 和EOF的理解
下载我们在linux文本界面下测试下 $cat hao.c $wo mei you chi fan $cat > hao.c << EOF >where are you > ...
- TSOJ--2018 江苏省省赛
[2018 江苏省大学生程序设计大赛] K. 2018 (测试数据范围有扩大) Problem Given a, b, c, d, find out the number of pairs of int ...
- 算法学习记录-图——最小生成树之Kruskal算法
之前的Prim算法是基于顶点查找的算法,而Kruskal则是从边入手. 通俗的讲:就是希望通过 边的权值大小 来寻找最小生成树.(所有的边称为边集合,最小生成树形成的过程中的顶点集合称为W) 选取边集 ...
- chromedriver 下载
https://sites.google.com/a/chromium.org/chromedriver/downloads 百度网盘链接:https://pan.baidu.com/s/1nwL ...
- ecplise建立模拟器,安装apk文件
方法一,把所要安装的apk,例xxx.apk拷贝到sdk下的adb的路径下,也就是和adb在同一个文件夹,比如我的是D:\Program Files\Android\sdk\platform-tool ...
- A. Test for Job
A. Test for Job Time Limit: 5000ms Case Time Limit: 5000ms Memory Limit: 65536KB 64-bit integer IO ...
- iOS静态库(.a文件)
1.找到静态库工程
- Spark与Pandas中DataFrame对比(详细)
Pandas Spark 工作方式 单机single machine tool,没有并行机制parallelism不支持Hadoop,处理大量数据有瓶颈 分布式并行计算框架,内建并行机制paral ...
- 洛谷P3097 - [USACO13DEC]最优挤奶Optimal Milking
Portal Description 给出一个\(n(n\leq4\times10^4)\)个数的数列\(\{a_n\}(a_i\geq1)\).一个数列的最大贡献定义为其中若干个不相邻的数的和的最大 ...
- hdu4336 Card Collector(概率DP,状态压缩)
In your childhood, do you crazy for collecting the beautiful cards in the snacks? They said that, fo ...