css小样式汇总

几个块元素之间间距问题

在这里插入图片描述

    //&-info是该div的父类
    &-info div:not(:last-child) {
        margin-right: 50px;
    }

渐变边框,圆角矩形渐变背景,水球,svg

在这里插入图片描述

<template>
    <div class="demo-nav">
        <div class="demo1"></div>
        <div class="demo2" style="margin-top: 10px" ref="demo2"></div>
        <div class="per-content">{{per}}%</div>
        <div class="box-inner">
            <div class="inner" ref="inner">
                <svg xmlns="http://www.w3.org/2000/svg" version="1.0" viewBox="0 0 600 140" class="box-waves">
                   <path d="M 0 70 Q 75 20,150 70 T 300 70 T 450 70 T 600 70 L 600 140 L 0 140 L 0 70Z">
                    </path>
                </svg>
                <svg xmlns="http://www.w3.org/2000/svg" version="1.0" viewBox="0 0 600 140" class="box-waves">
                   <path d="M 0 70 Q 75 20,150 70 T 300 70 T 450 70 T 600 70 L 600 140 L 0 140 L 0 70Z">
                    </path>
                </svg>
                <!-- <svg xmlns="http://www.w3.org/2000/svg" version="1.0" viewBox="0 0 600 140" class="box-waves">
                   <path d="M 0 70 Q 75 20,150 70 T 300 70 T 450 70 T 600 70 L 600 140 L 0 140 L 0 70Z">
                    </path>
                </svg> -->
            </div>
        </div>
        <!-- 改后缀名为svg的icon颜色, svg中的fill为currentColor,继承的是父类color -->
        <div class="demo-svg" style="color: green">
            <svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
                <title>元件/组件图标/提示/</title>
                <g id="元件/组件图标/提示/面" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
                    <path d="M8,16 C3.581722,16 0,12.418278 0,8 C0,3.581722 3.581722,0 8,0 C12.418278,0 16,3.581722 16,8 C16,12.418278 12.418278,16 8,16 Z M7.5,11.5 C7.5,11.7762581 7.72387097,12 8,12 C8.27612903,12 8.5,11.7762581 8.5,11.5 C8.5,11.2237419 8.27612903,11 8,11 C7.72387097,11 7.5,11.2237419 7.5,11.5 Z M8,4 C7.72385763,4 7.5,4.22385763 7.5,4.5 L7.5,9.5 C7.5,9.77614237 7.72385763,10 8,10 C8.27614237,10 8.5,9.77614237 8.5,9.5 L8.5,4.5 C8.5,4.22385763 8.27614237,4 8,4 Z" id="icon换色层" fill="currentColor"></path>
                </g>
            </svg>
        </div>
    </div>
</template>

<script>
export default {
    data() {
        return {
            per: 0
        }
    },
    mounted() {
        this.getData()
    },
    destroyed() {},
    methods: {
        getData() {
            let i = 0
            let timer = null
            timer = setInterval(() => {
                if(i < 100) {
                    i++
                    this.$refs.inner.style.bottom = (-128 + i) + '%'
                    this.per = i
                } else {
                    i = 0;
                    clearInterval(timer)
                    this.$refs.inner.style.bottom = -128 + '%'
                    this.per = 0
                    this.getData()
                }
            }, 90);

        }
    }
}
</script>
<style scoped>
.demo-nav {
    padding: 30px;
}
.demo1 {
    width: 60px;
    height: 60px;
    border: 2px solid;
    border-image: linear-gradient(180deg, red, orange) 1;
}
.demo2 {
    width: 80px;
    height: 80px;
    border: 2px solid transparent;
    background-image: linear-gradient(180deg, red, orange), linear-gradient(180deg, red, orange);
    /* 前一个内容背景色,后面为边框渐变色 */
    background-origin: border-box;
    background-clip: content-box, border-box;
    border-radius: 10px;
    animation: 2s toBorder linear infinite alternate;
}
@keyframes toBorder {
    100% {
        border-radius: 50%;
    }
}

.box-inner {
    width: 200px;
    height: 200px;
    box-shadow: 0px 2px 7px 0px #238fdb;
    border-radius: 50%;
    position: relative;
    border: 2px solid transparent;
    background-image: linear-gradient(#021f40, #021f40), linear-gradient(180deg, rgba(36, 144, 220, 0.41), rgba(37, 147, 225, 1));
    background-origin: border-box;
    background-clip: content-box, border-box;
    overflow: hidden;
    
}
.inner {
    width: 100%;
    height: 100%;
    position: absolute;
    left: 0;
    bottom: 0%;
    background-color: #a0edff;
}
.box-waves {
    position: absolute;
    left: 0;
    bottom: 100%;
    width: 200%;
    /* fill: #a0edff; */
    stroke: none;
}
.box-waves:nth-child(1) {
    fill: #146DA1;
    transform: translate(-50%, 0);
    z-index: 3;
    animation: wave-move1 1.5s linear infinite;
}
.box-waves:nth-child(2) {
    fill: #a0edff;
    transform: translate(0, 0);
    z-index: 3;
    animation: wave-move2 2s linear infinite;
    margin-bottom: -2px;
}
.box-waves:nth-child(3) {
    fill: #9dd1f0;
    transform: translate(0, 0);
    z-index: 3;
    animation: wave-move3 1.5s linear infinite;
}
@keyframes wave-move1 {
    100% {
        transform: translate(0, 0);
    }
}
@keyframes wave-move2 {
    100% {
        transform: translate(-50%, 0);
    }
}
@keyframes wave-move3 {
    100% {
        transform: translate(-50%, 0);
    }
}
.per-content {
    /* position: absolute; */
    z-index: 10;
    position: relative;
    top: 106px;
    left: 80px;
    font-size: 20px;
}
.demo-svg {
    /* width: 200px;
    height: 200px;
    border: 1px solid red; */
}
/* .svg  {
  fill: #77809F;
  color: #dae0f8;
} */
</style>

图片旋转360deg

<img src="../assets/logo.png" alt="" class="cover-anim">
.cover-anim {
    animation: coverRoute 16s linear infinite;
}
@keyframes coverRoute {
    form {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

让字体显示一行,超出隐藏并显示点点点

<div class="father">
    <div class="son">让字体显示一行,超出隐藏并显示点点点</div>
</div>
.father {
    width: 80px;
    overflow: hidden;
}
.son {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

显示二行,超出隐藏,显示点点点

<div class="father1">
     <div class="son1">显示二行,超出隐藏,显示点点点</div>
</div>
.father1 {
    width: 80px;
    overflow: hidden;
}
.son1 {
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    -moz-line-clamp: 2;
    -moz-box-orient: vertical;
    word-wrap: break-word;
    word-break: break-all;
    white-space: normal;
    overflow: hidden;
}

网站置灰

在这里插入图片描述

// 根目录标签下
.app {
  filter: grayscale(.95);
  -webkit-filter: grayscale(.95);
}

毛玻璃

backdrop-filter
backdrop-filter: none|filter|initial|inherit;
在这里插入图片描述

<div class="test">
	<div class="child">123456</div>
</div>
.test {
    width: 400px;
    height: 400px;
    background: url('../assets/hchunf_ctn.png') no-repeat;
    background-size: cover;
    display: flex;
    justify-content: center;
    align-items: center;
    .child {
        width: 300px;
        height: 300px;
        background-color: rgba(255, 255, 255, .7);
        backdrop-filter: blur(10px);
    }
}

data中定义得值

<div class="login">
	<div class="width-login"></div>
</div>

data() {
  return {
    uwidth: '10px'
  };
  },
.login {
	--uid-with: v-bind(uwidth);
	.width-login {
  		width: var(--uid-with);
  		height: var(--uid-with);
  		border: 1px solid red;
	}
}

css样式网址收集

https://juejin.cn/post/7164527444731363336
运动图形小特效:
https://juejin.cn/post/7166142204019228702
三角形、五角星:
https://juejin.cn/post/7114306621144039455
对话框:
https://juejin.cn/post/7124314655110987807
水球进度条:
https://juejin.cn/post/7164050832181166094
svg:
https://juejin.cn/post/6926353919333531661
动态霓虹灯:
https://juejin.cn/post/6844903493799510029

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
微信小程序前端面试题包括以下几个方面的内容: 1. 关于wxml和标准的html的异同:wxml是微信小程序的组件标记语言,而html是网页的标记语言。它们的语法和标签有一些异同,但是主要的区别在于功能和用途上。wxml更加轻量级,专注于小程序的渲染和交互逻辑,而html更加强大,适用于网页开发的各种需求。 2. WXSS和CSS的异同:WXSS是微信小程序的样式语言,CSS是网页的样式表语言。它们的语法和属性有一些异同,但是主要的区别在于单位和选择器的限制上。WXSS使用rpx作为单位,可以根据屏幕宽度进行自适应,而CSS使用像素单位。另外,WXSS对选择器的支持较少,只支持基本的选择器,不支持复杂的选择器。 3. 微信小程序主要目录和文件的作用:微信小程序主要包括app.json、app.js、app.wxss、pages等目录和文件。app.json用来配置小程序的全局配置,app.js是小程序的全局逻辑文件,app.wxss是小程序的全局样式文件,pages目录用来存放小程序的页面文件。 4. 小程序的双向绑定和vue的异同:微信小程序使用setData方法来实现页面数据的双向绑定,而Vue使用v-model指令来实现数据的双向绑定。两者的实现原理和语法有一些异同,但是都可以实现数据的变化同步到页面上。 5. 微信小程序的相关文件类型:微信小程序的相关文件类型包括wxml、wxss、js、json、图片、音频、视频等。wxml文件是组件的模板文件,wxss文件是组件的样式文件,js文件是组件的逻辑文件,json文件是组件的配置文件,图片、音频、视频等文件是组件的资源文件。 6. 微信小程序的传值方法:微信小程序有多种传值方法,包括通过URL传参、通过setData方法传参、通过全局变量传参、通过Storage API传参等。 以上是微信小程序前端面试题的一部分内容,还有其他问题可以根据需要进一步探讨。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *3* [【前端面试题——微信小程序】](https://blog.csdn.net/zz130428/article/details/129819232)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *2* [2020微信小程序前端面试题汇总](https://blog.csdn.net/guopeisi/article/details/104890221)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值