20230906 图标放大缩小闪动效果
.gift {
animation: warn 1s linear infinite alternate;
@keyframes warn {
0% {
transform: scale(1);
}
100% {
transform: scale(1.1);
}
}
}
20221110 小程序横向滚动隐藏滚动条
&::-webkit-scrollbar{
width: 0;
height: 0;
}
20220615 鼠标悬浮图片放大缩放效果
.list-item:hover image {
transform: scale(1.06);
transition: all .6s ease 0s;
}
.list-item{
cursor: pointer;
overflow: hidden;
image{
width: 100%;
height: 400px;
display: block;
transition: all .6s ease 0s;
}
}
20220610 自定义滚动条样式 -webkit-scrollbar
/*滚动条整体粗细样式*/
::-webkit-scrollbar {
width: 8px;
height: 8px;
}
/*滚动条里面小方块*/
::-webkit-scrollbar-thumb {
border-radius: 10px !important;
box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2) !important;
background: #b6b6b6 !important;
}
/*滚动条轨道*/
::-webkit-scrollbar-track {
border-radius: 10px !important;
box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2) !important;
background: #EDEDED !important;
}
20220224 小程序底部按钮自适应iphoneX及以上机型
margin-bottom: calc(constant(safe-area-inset-bottom));
margin-bottom: calc(env(safe-area-inset-bottom));
20211118 由于微信自带字体放大功能 苹果手机禁止字体放大
text-size-adjust: 100% !important;
-moz-text-size-adjust: 100% !important;
-webkit-text-size-adjust: 100% !important;
20211115 边框倒三角和实体右三角
<div class="date">ffffffffffff
<div class="triangle"></div>
</div>
.date{
display: inline-block;
border-radius: 28px;
position: relative;
border: 1px solid;
padding: 10px;
.triangle{
position: absolute;
bottom: -9px;
left: 40%;
width: 16px;
height: 16px;
background: #fff;
border-right: 1px solid;
border-bottom: 1px solid;
transform: rotate(45deg);
}
}
.date{
padding: 8px;
border-radius: 8px;
display: inline-block;
position: relative;
border: 1px solid;
background: red;
color: #ffffff;
.triangle{
border-width: 8px;
border-color: transparent transparent transparent red;
border-style: dotted dotted dotted solid;
position: absolute;
top: 10px;
right: -16px;
}
}
20211109 flex布局横向超出横向滚动
.people-list{
display: flex;
overflow-x: auto;
.list-item{
flex-shrink: 0;
white-space: nowrap;
width:30%;
margin-right: 5%;
}
}
20211029 css及less/scss如何定义变量
html{
--mainColor: #000;
}
span{
color: var(--mainColor);
}
<style scoped lang="scss">
$color:var(--color);
.fund-process{
color:$color;
}
</style>
document.getElementsByTagName('body')[0].style.setProperty('--color','red')
20210927 解决checkbox与文字对不起的问题
.checkbox {
margin-right: 4px;
position: relative;
top: 2px;
}
20210824 隐藏滚动条
::-webkit-scrollbar {
width:0;
height:0;
color:transparent;
}
20210520 解决纯数字或字母不自动换行
word-break: break-all;
20210518 css控制图片不可保存
<img src="" oncontextmenu="return false;"> // 禁止鼠标右键保存图片
<img src="" ondragstart="return false;"> // 禁止鼠标拖动图片
20210518 css控制文本不可选择复制
-webkit-user-select: none;
-ms-user-select: none;
-moz-user-select: none;
-khtml-user-select: none;
user-select: none;
20210129 强行覆盖elementUI样式
在类名前面加/deep/或::v-deep
20210128 css实现图片宽高绝对相等
<a style="width: 30%;height: 0;padding-bottom: 30%;position: relative;">
<img style="width: 100%;height: 100%;position: absolute;left: 0;top: 0;">
</a>
20210125 css字体纵向拉伸
transform: scale(1,2);
20200418 鼠标悬浮文本颜色渐变
.kind:hover .name{
color: #3FA8FF;
-webkit-transition-property:color;
-o-transition-property:color;
-moz-transition-property:color;
-webkit-transition-duration:0.5s;
-o-transition-duration:0.5s;
-moz-transition-duration:0.5s;
}
20200417 css内容超出横向滚动
white-space:nowrap;
overflow-x: auto;
20210326 标签实现文字上下左右滚动
<marquee behavior="scroll" scrolldelay="100">
<div>文字左右滚动上下滚动,哈哈哈哈哈哈哈哈哈!</div>
</marquee>
20200331 小程序端设置border用px 不要用rpx 否则会在安卓端变粗
20200227 input框type=file时设置cursor:pointer不起作用怎么办
cursor: pointer;
font-size: 0;
20200102 elementUI el-card卡片头部样式修改
原因解析:直接在当前页覆盖.el-card__header样式发现并未生效,scoped私有化导致的。去除scoped即可,但是全局的卡片头部样式都跟着修改了。解决办法:曲线救国 自定义样式;当然还有一种解决办法,就是用 /deep/ 在当前页样式强制覆盖。
<div class="card-header">我是标题</div>
.card-header {
margin: -20px -20px 20px;
padding: 10px 20px;
background: #d2d4d8;
}
20191229 最简单的流媒体布局的实现
.list{
column-count:2;
column-gap: 12rpx;
}
.list .item{
break-inside: avoid;
box-sizing: border-box;
/* display: inline-block; */
}
20191207 修改placeholder样式 字体颜色大小
input::-webkit-input-placeholder {
/* WebKit browsers */
color: red;
font-size: 16px;
}
input::-moz-placeholder {
/* Mozilla Firefox 19+ */
color: red;
font-size: 16px;
}
input:-ms-input-placeholder {
/* Internet Explorer 10+ */
color: red;
font-size: 16px;
}
20200102 :style设置backgroundImage
<div :style="{backgroundImage:'url('+imgUrl+')'}"></div>
20191206 css实现毛玻璃效果(高斯模糊)
filter: blur(10px) // 值越大越模糊
ios系统下input去掉上边框阴影
outline: none;
-webkit-appearance: none;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
文本单行超出省略号
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
文本多行超出省略号
overflow:hidden;
text-overflow:ellipsis;
display:-webkit-box;
-webkit-line-clamp:2;
/*! autoprefixer: off */
-webkit-box-orient:vertical;
/* autoprefixer: on */
1.加上面两行注释的原因是避免vue-cli打包后-webkit-box-orient:vertical丢失问题
2.多行时最好与line-height结合使用 避免有些手机文本超出后依然显示
css如何设置背景透明而文字不透明
// 通常情况下 这样写背景和内容都会透明
background-color:#000000;
opacity: 0.6;
// 但有时候只想让背景透明 内容正常显示
background-color:rgba(0,0,0,0.6);
css如何同时设置背景图片和背景色
background: url('../img/bg.png') no-repeat top,#DA2121;
文字样式处理 横线下划线 倾斜间距
text-decoration:underline; // 文字底部下划线
text-decoration:line-through; // 文字中间加横线
font-style: italic; // 字体倾斜
letter-spacing:2px; // 字体间距
div设置宽度等于100%后加padding内容会溢出
box-sizing:border-box;
块级元素和图片元素上下并列时会有间隙 设置display: block
背景色设置为linear-gradient渐变色时必须使用background属性
elementUI中show-overflow-tooltip="true"在safari等浏览器上失效问题
<el-table-column align="center" prop="PushContent" label="消息详情" width="200">
<template slot-scope="scope">
<el-tooltip v-if="scope.row.PushContent.length>10" class="item" effect="dark" :content="scope.row.PushContent" placement="top">
<div style="width: 180px;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;">{{scope.row.PushContent}}</div>
</el-tooltip>
<div v-if="scope.row.PushContent.length<=10">{{scope.row.PushContent}}</div>
</template>
</el-table-column>