.login { background: white; opacity: 0.85; border-radius: 15px; width: 630px; height: 750px; padding: 80px; margin: 90px 200px; }
时间: 2024-03-07 08:51:51 浏览: 22
这是一个 CSS 样式表中的规则,它定义了一个选择器为 `.login` 的样式。具体来说,它设置了登录框(或登录页面)的背景颜色为白色,透明度为 0.85(即略带半透明效果),边框圆角为 15 像素,宽度为 630 像素,高度为 750 像素,内边距为 80 像素,外边距为上下各 90 像素,左右各 200 像素。这些样式可以使登录框在页面上居中且美观。
相关问题
.commodity-di .general, .draft_status { font-size: 14px; color: #e3ea07; margin-bottom: 10px; } .commodity-di .general { margin-bottom: 15px; } .commodity-di .pay_title { font-size: 14px; color: #10bdd8; border-radius: 10px; margin-top: -35px; margin-left: -1px; padding-bottom: 5px; } .commodity-di .pay_title span { background: linear-gradient(#15c6cf38, #0ab0e647); padding: 5px 30px 5px 30px; border-left: 1px dashed #15c8ca8f; border-top-left-radius: 10px; border-top-right-radius: 10px; border-bottom: none; } .commodity-di .pay-content { margin-top: 50px; border-left: 1px dashed #15c8ca8f; border-bottom: 1px dashed #15c8ca8f; border-right: 1px dashed #15c8ca8f; background: linear-gradient(#18cfc300, #97e2ef14); border-radius: 10px; border-top-left-radius: 0; } .commodity-di .pay_list { padding-left: 15px; padding-right: 15px; } 帮我用以上CSS做出一款渐渐显示的弹窗效果,并且要配合html
好的,下面是一个简单的渐显弹窗的样式和HTML代码:
HTML代码:
```
<div class="modal-wrapper">
<div class="modal">
<div class="modal-header">
<h3>提示</h3>
<button class="close-btn">×</button>
</div>
<div class="modal-body">
<p>这是一个渐显弹窗。</p>
</div>
<div class="modal-footer">
<button class="confirm-btn">确定</button>
<button class="cancel-btn">取消</button>
</div>
</div>
</div>
```
CSS代码:
```
/* 弹窗外层容器 */
.modal-wrapper {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.6);
z-index: 9999;
display: none;
}
/* 弹窗容器 */
.modal {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 400px;
background-color: #fff;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
opacity: 0;
}
/* 弹窗标题栏 */
.modal-header {
padding: 10px;
text-align: center;
background-color: #f5f5f5;
border-top-left-radius: 10px;
border-top-right-radius: 10px;
}
/* 弹窗内容区域 */
.modal-body {
padding: 20px;
text-align: center;
}
/* 弹窗底部按钮区域 */
.modal-footer {
padding: 10px;
text-align: center;
background-color: #f5f5f5;
border-bottom-left-radius: 10px;
border-bottom-right-radius: 10px;
}
/* 确认按钮样式 */
.confirm-btn {
background-color: #4caf50;
color: #fff;
border: none;
padding: 10px 20px;
border-radius: 5px;
margin-right: 10px;
}
/* 取消按钮样式 */
.cancel-btn {
background-color: #f44336;
color: #fff;
border: none;
padding: 10px 20px;
border-radius: 5px;
}
/* 关闭按钮样式 */
.close-btn {
position: absolute;
top: 0;
right: 0;
font-size: 30px;
color: #aaa;
background-color: transparent;
border: none;
padding: 0 10px;
outline: none;
}
/* 弹窗渐显动画 */
.modal.fade-in {
animation: fade-in 0.5s forwards;
}
@keyframes fade-in {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
```
JavaScript代码:
```
// 获取弹窗元素
var modalWrapper = document.querySelector('.modal-wrapper');
var modal = document.querySelector('.modal');
// 弹窗渐显函数
function fadeInModal() {
modal.classList.add('fade-in');
modalWrapper.style.display = 'block';
}
// 弹窗关闭函数
function closeModal() {
modal.classList.remove('fade-in');
modalWrapper.style.display = 'none';
}
// 确认按钮点击事件处理函数
function handleConfirmClick() {
console.log('点击了确认按钮');
closeModal();
}
// 取消按钮点击事件处理函数
function handleCancelClick() {
console.log('点击了取消按钮');
closeModal();
}
// 关闭按钮点击事件处理函数
function handleCloseClick() {
console.log('点击了关闭按钮');
closeModal();
}
// 绑定点击事件
document.querySelector('.confirm-btn').addEventListener('click', handleConfirmClick);
document.querySelector('.cancel-btn').addEventListener('click', handleCancelClick);
document.querySelector('.close-btn').addEventListener('click', handleCloseClick);
// 调用弹窗渐显函数
fadeInModal();
```
这是一个简单的渐显弹窗效果,你可以根据具体的需求进行自定义修改。
* { 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; }
这段代码是一个简单的搜索框样式,使用了CSS3的动画效果。其中包括一个圆形搜索按钮(红色),点击按钮后输入框会从小圆圈扩大为长方形,并且搜索按钮会移动到输入框的左侧,并且变为白色。同时,输入框的背景颜色也会变成一个深色,并且输入框的宽度会变宽,以便用户能够输入更多的内容。在输入框中输入搜索内容时,输入框的文本颜色变为白色,而搜索按钮的形状也会变化,以增强用户的反馈感。