随笔分类 - HTML&CSS
超文本标记语言(HyperText Markup Language) & 层叠样式表(Cascading Style Sheets)
摘要:使用开源库:html2canvas<!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.
阅读全文
摘要:要实现强制分为指定段数,并且对齐刻度,需要用的配置分别为yAxis的max、min、interval echarts5.3有个配置项alignTicks,在多个 y 轴为数值轴的时候,可以开启该配置项自动对齐刻度。只对'value'和'log'类型的轴有效。实际使用中,发现在双轴数据格式不同,且数值
阅读全文
摘要:@supports 兼容性很好,所以使用 @supports 做兼容是个不错的选择。 例: @supports (padding-bottom: env(safe-area-inset-bottom)) or (padding-bottom: constant(safe-area-inset-bot
阅读全文
摘要:一、 &::after { content: ""; position: absolute; top: -50%; bottom: -50%; left: -50%; right: -50%; border: 1px solid #e9e9e9; border-radius: 2px; -webki
阅读全文
摘要:方法一: 首先,在拖动 div 时,判断当前容器 div 是否有滚动条,如果没有,则禁止整个 div 拖动,例: const list_dom: any = document.querySelector(".list"); list_dom.addEventListener("touchmove",
阅读全文
摘要:移动端分页列表,在ios上滚动加载分页时候,使用scrollTop,会引起白屏问题。 看不少文章说是使用了-webkit-overflow-scrolling: touch;引起的硬件加速问题。亲测删除问题仍然存在。 this.$nextTick(() => { window.scrollTo(0,
阅读全文
摘要:之所以100vh在移动端出现问题,原因大致如上图,真搞不懂,为什么总是有反人类的设计出现。 经过多方参考,实测有效的方案如下: <style> :root { --vh: 1vh; } </style> <script> !(function (n, e) { function setViewHei
阅读全文
摘要:示例项目地址: https://github.com/skillnull/lottie-web-caption-animation 首先是安装AE,具体怎么安装就不赘述了,随便一搜就有很多教程。 安装完AE以后,装一个AE的插件bodymovin, github地址为: https://github
阅读全文
摘要:<template> <audio src="./static/music.mp3" id="bgMusic" preload="auto" loop></audio> <div class="bgMusicBtn" @click="bgMusicPlayOrPause('bgMusic')"> <
阅读全文
摘要:周知,表格的斑马条纹只需简单的运用伪类 :nth-child()/:nth-of-type()来处理就好了: tr:nth-child(even){ background-color: rgba(0,0,0,.2); } 但是把这种效果运用在文本行的时候就有点力不从心了,尽管js可以实现这种功能,但
阅读全文
摘要:以前写毛玻璃用的都是图层覆盖-->传送门,看了 LEA VEROU 的《CSS揭秘》后才发现还有更优雅的毛玻璃:
阅读全文
摘要:做一个登录页,全屏背景图毛玻璃效果,实现方法如下: HTML: <body> <div class="login-wrap"> <div class="login-mask"></div> <div class="login-box"></div> </div> <script> var w = w
阅读全文
摘要:微信开发的时候,如果页面顶部有轮播图,底部有导航栏,中间是栏目,那么让中间的栏目,如何根据设备的高度,来进行自适应的填充呢? 首先想到的是运用媒体查询,但是媒体查询效果差,效率低,所以就运用jQuery写法来进行实现。 效果图: 首先知道顶部的轮播图的固定高度是200px,底部的导航栏固定高度是50
阅读全文
摘要:textarea { width: 100%; border: none; outline: none; resize: none; overflow: hidden; padding-bottom: 100%; background-color: inherit;} <textarea reado
阅读全文
摘要:::-webkit-scrollbar { // 滚动条整体部分 width: 6px; height: 8px; } ::-webkit-scrollbar-track { // 外层轨道 background-color: #eee; border-radius: 4px; } ::-webki
阅读全文
摘要:为网站的图片加上加载失败的默认占位符会让网站看起来更专业、更严谨。 <img src="__PUBLIC__/img/simple/simplelove.png" onerror="onerror=null;src='__PUBLIC__/img/defaultpic.jpg'"> 如果图片加载失败
阅读全文
摘要:<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <meta http-equiv="X-UA-COMPATIBLE" content="IE=edge"> <style> .choose { margin: .5em 0; b
阅读全文
摘要:textarea::-webkit-input-placeholder{ padding: 1em; } textarea::-moz-placeholder{ padding: 1em; } 同理,input的定义方法为: input::-webkit-input-placeholder{ pad
阅读全文