julytian / h5skills Goto Github PK
View Code? Open in Web Editor NEW整理记录和收集平时h5技巧与分享
整理记录和收集平时h5技巧与分享
1、在非body元素,添加这个属性,竟然没有效果。如果添加上overflow-y: scroll,就可以优雅的滚动起来了。
2、当一个元素设置过position: absolute|relative,后再增加-webkit-overflow-scrolling: touch;属性后,会发现,滑动几次后就滚动区域会卡住,不能在滑动,这时给元素增加个z-index值就可以了。
解决方法:
给元素增加个z-index值
webkit-overflow-scrolling: touch;
position:relative;
z-index:1;
QQ内置浏览器出现了不可预见的bug:向下/向上快速滑动页面的时候,页面会出现空白,等滑动结束后内容显示;安卓无此问题。
解决方法: 在滑动范围的父级添加以上css,即可解决;
-webkit-backface-visibility: hidden;
-webkit-transform: translate3d(0,0,0);
结合行高、对齐的关系,结合伪元素得出的黑科技,亲测效果很理想。
.btn::before {
content: '';
display: inline-block;
vertical-align: middle;
width: 0;
height: 100%;
margin-top: 1px;
}
一般我们写一个导航条,每个导航之间都设置空隙(除了最后一个),代码以下:
<div class="navbar">
<a href="#">首页</a>
<a href="#">关于我们</a>
<a href="#">个人中心</a>
<a href="#">联系我们</a>
</div>
.navbar a {
margin-right: 10px;
}
.navbar a:last-child {
margin-right: 0;
}
看起来总觉得很别扭,现在可以使用 :not() 来简化样式
.navbar a:not(:last-child) { /* 除了最后一个 */
margin-right: 20px;
}
input:disabled {
-webkit-text-fill-color: #ddd;
}
.example::-webkit-input-placeholder {
color: red;
}
input {
border: none;
background: none;
appearance: none;
border-radius: 0;
}
a, button, input {
-webkit-tap-highlight-color: rgba(255, 0, 0, 0);
}
<input type="text" autocapitalize="off">
.text{
width: 100px;
overflow: hidden;
text-overflow: ellipsis;
white-scaple: nowrap;
}
.text{
width: 100px;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 3; /* 超过3行就显示省略号 */
text-overflow: ellipsis;
overflow: hidden;
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.