* { margin: 0; padding: 0; box-sizing: border-box; } html, body { width: 100%; height: 100%; } body { background: #252525; } .container { position: absolute; margin: auto; top: 0; left: 0; right: 0; bottom: 0; width: 300px; height: 100px; } .container .search { position: absolute; margin: auto; top: 0; right: 0; bottom: 0; left: 0; width: 80px; height: 80px; background: crimson; border-radius: 50%; transition: all 1s; z-index: 4; box-shadow: 0 0 25px 0 rgba(0, 0, 0, 0.4); } .container .search:hover { cursor: pointer; } .container .search::before { content: ""; position: absolute; margin: auto; top: 22px; right: 0; bottom: 0; left: 22px; width: 12px; height: 2px; background: white; transform: rotate(45deg); transition: all 0.5s; } .container .search::after { content: ""; position: absolute; margin: auto; top: -5px; right: 0; bottom: 0; left: -5px; width: 25px; height: 25px; border-radius: 50%; border: 2px solid white; transition: all 0.5s; } .container input { font-family: "Inconsolata", monospace; position: absolute; margin: auto; top: 0; right: 0; bottom: 0; left: 0; width: 50px; height: 50px; outline: none; border: none; background: crimson; color: white; text-shadow: 0 0 10px crimson; padding: 0 80px 0 20px; border-radius: 30px; box-shadow: 0 0 25px 0 crimson, 0 20px 25px 0 rgba(0, 0, 0, 0.2); transition: all 1s; opacity: 0; z-index: 5; font-weight: bolder; letter-spacing: 0.1em; } .container input:hover { cursor: pointer; } .container input:focus { width: 300px; opacity: 1; cursor: text; } .container input:focus ~ .search { right: -250px; background: #151515; z-index: 6; } .container input:focus ~ .search::before { top: 0; left: 0; width: 25px; } .container input:focus ~ .search::after { top: 0; left: 0; width: 25px; height: 2px; border: none; background: white; border-radius: 0%; transform: rotate(-45deg); } .container input::placeholder { color: white; opacity: 0.5; font-weight: bolder; }

时间: 2024-04-28 10:27:00 浏览: 13
这段代码是一个简单的搜索框样式,使用了CSS3的动画效果。其中包括一个圆形搜索按钮(红色),点击按钮后输入框会从小圆圈扩大为长方形,并且搜索按钮会移动到输入框的左侧,并且变为白色。同时,输入框的背景颜色也会变成一个深色,并且输入框的宽度会变宽,以便用户能够输入更多的内容。在输入框中输入搜索内容时,输入框的文本颜色变为白色,而搜索按钮的形状也会变化,以增强用户的反馈感。
相关问题

<template> <div id="app" class=""> <router-view></router-view> </div> </template> <script> export default { name: "app", }; </script> <style lang="scss"> *{ padding: 0; margin:0; box-sizing: border-box; } html,body{ width: 100%; height: 100%; } #app{ height:100%; } body { padding: 0; margin: 0; } </style>

这段代码是一个 Vue.js 的组件,包含一个模板、一个脚本和一个样式表。模板中定义了一个包含 router-view 的 div 元素,这是 Vue Router 中用于展示路由组件的占位符。脚本中导出了一个名为 app 的组件,其中没有任何逻辑。样式表中定义了一些基本样式,如全局的盒模型、页面宽高为100%等,并将 #app 元素的高度设置为100%。 需要注意的是,这段代码中使用了 SCSS 语法,需要在项目中使用 SCSS 预处理器进行编译。

* { margin: 0; padding: 0; } .box { width: 500px; height: 30px; margin: 200px auto; } .big { width: 400px; height: 100%; background-color: blue; position: relative; box-sizing: border-box; float: left; } .small { width: 0; height: 100%; background-color: deeppink; } </style> </head> <body> <div class="box"> <div class="big"> <div class="small"></div> </div> <span>0%</span> </div>实现拖拽进度条,在后面显示百分比并且保留两位小数

好的,可以使用 JavaScript 和 CSS 来实现拖拽进度条和显示百分比。以下是一个简单的实现: HTML 代码: ```html <div class="box"> <div class="big"> <div class="small"></div> </div> <span id="percent">0%</span> </div> ``` CSS 代码: ```css * { margin: 0; padding: 0; } .box { width: 500px; height: 30px; margin: 200px auto; } .big { width: 400px; height: 100%; background-color: blue; position: relative; box-sizing: border-box; float: left; } .small { width: 0; height: 100%; background-color: deeppink; position: absolute; top: 0; left: 0; z-index: 1; } ``` JavaScript 代码: ```javascript const box = document.querySelector('.box'); const big = document.querySelector('.big'); const small = document.querySelector('.small'); const percent = document.querySelector('#percent'); let isDragging = false; const updatePercent = () => { const percentValue = (small.clientWidth / big.clientWidth) * 100; percent.textContent = percentValue.toFixed(2) + '%'; }; small.addEventListener('mousedown', () => { isDragging = true; }); document.addEventListener('mousemove', e => { if (isDragging) { const x = e.clientX - box.offsetLeft - (small.clientWidth / 2); const maxX = big.clientWidth - small.clientWidth; if (x < 0) { small.style.left = '0'; } else if (x > maxX) { small.style.left = maxX + 'px'; } else { small.style.left = x + 'px'; } updatePercent(); } }); document.addEventListener('mouseup', () => { isDragging = false; }); ``` 首先,我们在 HTML 中创建了一个包含一个大的蓝色块和一个小的粉色块的进度条。我们还添加了一个用于显示百分比的 `<span>` 元素。 然后,我们使用 CSS 来定义样式。我们将 `.small` 元素定位为绝对位置,使其可以在 `.big` 元素内部移动。我们还将其 `z-index` 属性设置为 1,以确保它显示在 `.big` 元素的顶部。 最后,我们使用 JavaScript 来实现拖拽功能和百分比更新。我们添加了 `mousedown`、`mousemove` 和 `mouseup` 事件监听器来检测鼠标拖拽操作,并更新小块的位置和百分比显示。我们还使用 `toFixed()` 方法将百分比值保留两位小数。

相关推荐

ul.head{ border-style: groove; position: fixed; top:0; width:99%; list-style-type: none; margin-top:0; padding-left: 0px; /*创建一个新的BFC*/ overflow: hidden; background:indianred; border-radius:8px;/*圆角边框*/ font-size:18px; } li a{ /* !*实现横向导航栏, display:inline;也可,如果你想链接到具有相同的大小,你必须使用浮动的方法*!*/ float:left; height:20px; text-align: center; color: white; background-color: darksalmon; padding: 12px 20px; text-decoration: none; } li a:hover{ background-color: coral; color: black; } body{ background-attachment: fixed; background-image: url(../resources/image/blue_pink.jpg); background-size:100%; } iframe{ height:300px; width:400px; float:right; } select{ font-size: 20px; color:olive; background-color:cornsilk; } div{ margin-top:60px; } input{font-size: 16px;} button { border-radius:5px;/*圆角边框*/ font-size: 18px; background-color: #4CAF50; color: white; cursor: pointer; transition: background-color 0.3s ease; } #pauseBtn{ position:absolute; bottom:17%; left:40%; } #startBtn{ position:absolute; bottom:59%; left:15%; } #increase-btn1 { position:absolute; left: 17%; bottom:9%; } #decrease-btn1 { position:absolute; left: 19%; bottom:9%; } #increase-btn2 { position:absolute; right: 19%; bottom:25%; } #decrease-btn2 { position:absolute; right: 17%; bottom:25%; } #speedRange{ position:absolute; bottom:17%; left:50%; } button:hover { background-color: #3e8e41; } #introduction{ margin-top: 20px; width:300px; border-style: groove; font-size: 14px; color:darkred; overflow: auto; min-height:300px; max-height:300px; } footer{ position:absolute; bottom:0; width:100%; height:30px; text-align: center; } #canvas{ /*width: 880px;*/ /*height: 440px;*/ width: 100%; height: 100%; /*margin: -210px auto;*/ /*border: 2px solid yellowgreen;*/ /*display: block;*/ overflow: scroll; } .container { height: 440px; width: 880px; margin: -225px auto; border: 2px solid yellowgreen; /*display: block;*/ box-sizing:border-box; overflow: scroll; } #log{ border:2px palegoldenrod; position:absolute; top:9%; right:0.5%; background-color:lightyellow; height: 430px; /* 设置固定高度 */ width: 310px; /* 设置固定宽度 */ font-size: 16px; /* 设置默认字体大小 */ resize: none; /* 其他样式属性 */ } .red-text { color: red; }

*{ margin: 0; padding: 0; } html,body{ height: 100%; } body{ width: 100%; background-image:radial-gradient(#22002a,#01001f) } a{ text-decoration: none; } #movie_info{ width: 990px; margin: 0 auto; padding-bottom: 60px; box-sizing: border-box; } #movie_info .info{ width: 100%; padding-bottom: 15px; border-bottom: 1px dotted rgb(255,255,255,0.3); } #movie_info .info img{ float: left; box-shadow: 0 0 6px #C4C4C4; margin-top: 36px; } table{ margin-top: 20px; margin-right: 10px; float: right; color: white; font-size: 13px; } table,tr,td,th{ border: none; } th{ font-size: 22px; text-align: left; height: 38px; line-height: 38px; color: #fdfed2; } td{ width: 240px; line-height: 24px; } table a{ display: block; width: 100px; height: 30px; line-height: 30px; border-radius: 5px; color: #FFFFFF; text-align: center; margin-top: 15px; } table .lookInfo{ background-image:linear-gradient(#9ac534,#427e22) ; } table .buy{ background-image:linear-gradient(#ff8b45,#ff5200) ; } table .score{ color: #f2a32e; } table .score .star{ margin-left: 15px; display: inline-block; width: 103px; height: 20px; background: url(../images/star_big.png) left -80px no-repeat; } table .score em{ font-size: 28px; color: #f2a32e; } #movie_info .info:after,#movie_info ul:after{ content: ""; display: block; clear: both; } /*猜你喜欢*/ #movie_info .like{ position: relative; } #movie_info .like span{ position: absolute; top: 10px; left: 25px; display: block; width: 100px; height: 30px; line-height: 30px; border-radius: 2px; background:rgb(220,216,216, 32%); color: #FFFFFF; text-align: center; font-size: 12px; } #movie_info .like ul{ width: 990px; height: 190px; position: absolute; top: 50px; left: 25px; overflow: hidden; } #movie_info .like ul:after{ content: ""; display: block; clear: both; } #movie_info .like li{ width: 119px; text-align: center; float: left; margin-right: 20px; font-size: 12px; color: #e1ab5b; line-height: 20px; cursor: pointer; } #movie_info .like li img{ width: 119px; height: 168px; }。每行代码加上注释

<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>键盘打字</title> <style> /* 基本界面样式 */ *{ /*margin: 0;*/ padding: 0; box-sizing: border-box; list-style: none; /*outline: 1px dashed purple;*/ } body{ display: flex; height: 100vh; justify-content: center;/* 水平居中*/ align-items: center; background-color: #000;/* 随内容撑开且垂直居中 */ } .keyboard{ outline-width: 3px; /*background-color: red;*/ } ul.row{ display: flex;/* 弹性布局 */ /* /*height: 300px; */ } ul.row li{ outline-width: 2px; width: 3em;/*em是根据当前字体大小*/ height: 3em; text-align: center; line-height: 3em; border-radius: .4em; color: rgba(0, 0, 0, 0.7); letter-spacing: 1px; margin: 0.4em; } /*设置宽度*/ #tab{ width: 5em; } #caps{ width: 6em; } #leftShift{ width: 8em; } #enter{ width: 6em; } #rightShift{ width: 8em; } #back{ width: 5em; } /*设置颜色*/ .little{ background-color: crimson; /*深红色的*/ border: 2px solid crimson; } .little.selected{ background-color: transparent; color: crimson; } .ring{ background-color: coral; /*珊瑚红*/ border:2px solid coral; } .ring.selected{ background-color: transparent; color: coral; } .middle{ background-color:darkorange; /*深橙色*/ border: 2px solid darkorange; } .middle.selected{ background-color: transparent; color: darkorange; } .forefinger1st{ background-color: gold; border: 2px solid gold; } .forefinger1st.selected{ background-color: transparent; color: gold; } .forefinger2nd{ background-color: khaki;

/* 全局css变量 */ $--color-primary: #409EFF; .primary-color { color: #409EFF; } .background-opacity { background: rgba(64, 158, 255, 0.6); } .form-widget-list { .ghost{ content: ''; font-size: 0; height: 3px; box-sizing: border-box; background: #409EFF; border: 2px solid #409EFF; outline-width: 0; padding: 0; overflow: hidden; } } .el-form-item--medium { .el-radio { line-height: 36px !important; } .el-rate{ margin-top: 8px; } } .el-form-item--small { .el-radio { line-height: 32px !important; } .el-rate{ margin-top: 6px; } } .el-form-item--mini { .el-radio { line-height: 28px !important; } .el-rate{ margin-top: 4px; } } .el-card { margin-top: 3px; margin-bottom: 3px; } input[type="password"]::-ms-reveal { /* 隐藏IE/Edge原生的密码查看按钮 */ display: none; } /* 滚动条样式 begin */ ::-webkit-scrollbar { width: 8px; height: 8px; } ::-webkit-scrollbar-track { width: 8px; background: rgba(#101F1C, 0.1); -webkit-border-radius: 2em; -moz-border-radius: 2em; border-radius: 2em; } ::-webkit-scrollbar-thumb { background-color: rgba(#101F1C, 0.35); background-clip: padding-box; min-height: 28px; -webkit-border-radius: 2em; -moz-border-radius: 2em; border-radius: 2em; } ::-webkit-scrollbar-thumb:hover { background-color: rgba(#101F1C, 0.85); } * {//Firefox浏览器滚动条样式 scrollbar-color: #e5e5e5 #f7f7f9; //滚动条轨道颜色、滚动条滑块的颜色 scrollbar-width: thin; //thin模式下滚动条两端的三角按钮会消失 } /* body {//IE浏览器滚动条样式 scrollbar-shadow-color: #e5e5e5; scrollbar-face-color: #e5e5e5; scrollbar-base-color: #ffffff; scrollbar-arrow-color: #444040; } */ /* 滚动条样式 end */

最新推荐

recommend-type

ADSP-BF533的例程源码29:FIR信号处理源码

ADSP-BF533的例程源码29:FIR信号处理源码
recommend-type

中文翻译Introduction to Linear Algebra, 5th Edition 2.1节

中文翻译Introduction to Linear Algebra, 5th Edition 2.1节 线性代数的核心问题是求解方程组。这些方程都是线性的,即未知数仅与数相乘——我们绝不会 遇见 x 乘以 y。我们的第一个线性方程组较小。接下来你来看看它引申出多远: 两个方程 两个未知数 x − 2y = 1 3x + 2y = 11 (1) 我们一次从一个行开始。第一个方程 x − 2y = 1 得出了 xy 平面的一条直线。由于点 x = 1, y = 0 解 出该方程,因此它在这条直线上。因为 3 − 2 = 1,所以点 x = 3, y = 1 也在这条直线上。若我们选择 x = 101,那我们求出 y = 50。 这条特定直线的斜率是 12,是因为当 x 变化 2 时 y 增加 1。斜率在微积分中很重要,然而这是线 性代数! 图 2.1 将展示第一条直线 x − 2y = 1。此“行图”中的第二条直线来自第二个方程 3x + 2y = 11。你 不能错过两条线的交点 x = 3, y = 1。点 (3, 1) 位于两条线上并且解出两个方程。
recommend-type

管理建模和仿真的文件

管理Boualem Benatallah引用此版本:布阿利姆·贝纳塔拉。管理建模和仿真。约瑟夫-傅立叶大学-格勒诺布尔第一大学,1996年。法语。NNT:电话:00345357HAL ID:电话:00345357https://theses.hal.science/tel-003453572008年12月9日提交HAL是一个多学科的开放存取档案馆,用于存放和传播科学研究论文,无论它们是否被公开。论文可以来自法国或国外的教学和研究机构,也可以来自公共或私人研究中心。L’archive ouverte pluridisciplinaire
recommend-type

识别MATLAB微分方程求解中的混沌行为:分析非线性方程混沌行为的实用技巧

![matlab求解微分方程](https://img-blog.csdnimg.cn/2021062810300367.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80MTQ3OTY3OA==,size_16,color_FFFFFF,t_70) # 1. MATLAB微分方程求解概述 微分方程是描述物理、工程和金融等领域中动态系统的数学模型。MATLAB提供了强大的工具来求解微分方程,包括内置求解器和自定义函数
recommend-type

physon如何做ERP系统

作为一个AI语言模型,我可以给您提供一些基本的建议和思路: 1.明确需求和目标:在开始开发ERP系统之前,需要明确您的业务需求和目标,了解您的业务流程、流程数据、员工角色和权限、财务管理等方面的要求,这样才能更好的设计和开发ERP系统。 2.选择技术框架和开发工具:选择合适的技术框架和开发工具是ERP系统开发的关键。选择一种流行的技术框架和工具可以提高开发效率和质量。 3.设计数据库:ERP系统需要一个功能强大的数据库来存储数据。设计数据库需要考虑数据的完整性、安全性和可扩展性。 4.设计系统架构:系统架构是ERP系统的骨架,需要考虑系统的可扩展性、可维护性和性能。 5.开发和测试:
recommend-type

zigbee-cluster-library-specification

最新的zigbee-cluster-library-specification说明文档。
recommend-type

"互动学习:行动中的多样性与论文攻读经历"

多样性她- 事实上SCI NCES你的时间表ECOLEDO C Tora SC和NCESPOUR l’Ingén学习互动,互动学习以行动为中心的强化学习学会互动,互动学习,以行动为中心的强化学习计算机科学博士论文于2021年9月28日在Villeneuve d'Asq公开支持马修·瑟林评审团主席法布里斯·勒菲弗尔阿维尼翁大学教授论文指导奥利维尔·皮耶昆谷歌研究教授:智囊团论文联合主任菲利普·普雷教授,大学。里尔/CRISTAL/因里亚报告员奥利维耶·西格德索邦大学报告员卢多维奇·德诺耶教授,Facebook /索邦大学审查员越南圣迈IMT Atlantic高级讲师邀请弗洛里安·斯特鲁布博士,Deepmind对于那些及时看到自己错误的人...3谢谢你首先,我要感谢我的两位博士生导师Olivier和Philippe。奥利维尔,"站在巨人的肩膀上"这句话对你来说完全有意义了。从科学上讲,你知道在这篇论文的(许多)错误中,你是我可以依
recommend-type

探索MATLAB微分方程求解中的分岔分析:揭示方程动态行为的秘密

![matlab求解微分方程](https://img-blog.csdnimg.cn/2021062810300367.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80MTQ3OTY3OA==,size_16,color_FFFFFF,t_70) # 1. MATLAB微分方程求解概述 微分方程在科学、工程和金融等领域有着广泛的应用。MATLAB作为一种强大的数值计算软件,提供了丰富的微分方程求解工具。本章将概述
recommend-type

ic验证工作中如何在平台中加入发数的总数?

在进行IC验证工作时,可以通过以下步骤在平台中加入发数的总数: 1. 打开IC验证工具(如Cadence Virtuoso)并打开对应的设计文件。 2. 在设计文件中选择需要计算发数的部分电路或模块。 3. 在IC验证工具中打开时序分析工具(如Cadence Tempus)。 4. 在时序分析工具中设置好时钟频率、时钟周期等参数。 5. 执行时序分析,生成时序报告。 6. 在时序报告中查找发数统计信息,将其记录下来。 7. 将发数统计信息添加到平台中,以便在之后的仿真或验证中使用。 需要注意的是,发数统计信息可能因为设计文件的不同而有所差异,需要根据实际情况进行调整和计算。
recommend-type

JSBSim Reference Manual

JSBSim参考手册,其中包含JSBSim简介,JSBSim配置文件xml的编写语法,编程手册以及一些应用实例等。其中有部分内容还没有写完,估计有生之年很难看到完整版了,但是内容还是很有参考价值的。