gpt4 book ai didi

html - 带有 Input 元素的 Button 发光效果的 CSS

转载 作者:太空宇宙 更新时间:2023-11-04 10:11:23 25 4
gpt4 key购买 nike

我想在我的按钮上添加闪光效果,该按钮最初是一个 html 输入元素(我不想更改它)。我做了一个 bootply,但不知道如何以正确的方式获得它。

/* CSS used here will be applied after bootstrap.css */
body{
background: #888;
}

span.button {
width: 100%;
height: 50px;
/*background: #333;*/
display: block;
position: relative;
margin: 50px auto 0;
overflow: hidden;
/*border: 1px solid #333333;*/
/*color: white;*/
text-decoration: none;

-webkit-box-shadow: inset 0px 1px 1px 0px rgba(255,255,255,.4);
-moz-box-shadow: inset 0px 1px 1px 0px rgba(255,255,255,.4);
box-shadow: inset 0px 1px 1px 0px rgba(255,255,255,.4);

-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;


-webkit-transition: all 0.2s ease;
-moz-transition: all 0.2s ease;
-ms-transition: all 0.2s ease;
-o-transition: all 0.2s ease;
transition: all 0.2s ease;

background-color: hsl(131, 100%, 5%) !important;
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#3CCC77", endColorstr="#00190B");
background-image: -khtml-gradient(linear, left top, left bottom, from(#3CCC77), to(#00190B));
background-image: -moz-linear-gradient(top, #3CCC77, #00190B);
background-image: -ms-linear-gradient(top, #3CCC77, #00190B);
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #3CCC77), color-stop(100%, #00190B));
background-image: -webkit-linear-gradient(top, #3CCC77, #00190B);
background-image: -o-linear-gradient(top, #3CCC77, #00190B);
background-image: linear-gradient(#3CCC77, #00190B);
border-color: #00190B #00190B hsl(131, 100%, -10%);
color: #fff !important;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.99);
-webkit-font-smoothing: antialiased;
}

span.button span.text {
position: absolute;
top: 16px;
left: 65px;
font: 15px Arial;
}

span.button span.shine {
content: '';
position: absolute;
height: 1000px;
width: 5px;
background: white;
top: -500px;
left: -80px;
display: block;
opacity: 0.8;

-webkit-box-shadow: 0px 0px 20px 10px white;
-moz-box-shadow: 0px 0px 20px 10px white;
box-shadow: 0px 0px 20px 10px white;

-webkit-transform: rotate(-45deg);
-moz-transform: rotate(-45deg);
-ms-transform: rotate(-45deg);
-o-transform: rotate(-45deg);
transform: rotate(-45deg);

-webkit-transition: all 1s ease;
-moz-transition: all 1s ease;
-ms-transition: all 1s ease;
-o-transition: all 1s ease;
transition: all 1s ease;
}

span.button:hover {
-webkit-box-shadow: inset 0px 1px 10px 0px rgba(255,255,255,.4), 0px 3px 3px 0px rgba(0,0,0,0.4);
-moz-box-shadow: inset 0px 1px 10px 0px rgba(255,255,255,.4), 0px 3px 3px 0px rgba(0,0,0,0.4);
box-shadow: inset 0px 1px 10px 0px rgba(255,255,255,.4), 0px 3px 3px 0px rgba(0,0,0,0.4);
}

span.button:active {
-webkit-box-shadow: inset 0px 1px 15px 0px rgba(0,0,0,.4), inset 0px 1px 1px 1px rgba(0,0,0,.2), 0px 1px 1px 0 rgba(255,255,255,.5);
-moz-box-shadow: inset 0px 1px 15px 0px rgba(0,0,0,.4), inset 0px 1px 1px 1px rgba(0,0,0,.2), 0px 1px 1px 0 rgba(255,255,255,.5);
box-shadow: inset 0px 1px 15px 0px rgba(0,0,0,.4), inset 0px 1px 1px 1px rgba(0,0,0,.2), 0px 1px 1px 0 rgba(255,255,255,.5);
}

span.button:hover span.shine {
left: 2000px;
top: -300px;
}
<span class="button">
<span class="shine"></span>

<span class="text"><input class="btn btn-block" type="submit" name="submit" value="YES - YES - YES" /></span>

</span>

Bootply

颜色和一切都已经正确了。效果很好。但 Input 元素应该与按钮作为一个整体。我试图将 html 输入元素重新定位到按钮范围内的任何其他位置,但这只会让一切变得更糟。

非常感谢任何帮助。非常感谢。

最佳答案

据我所知,您只需将该 css 添加到输入本身,否则从输入中删除背景样式并将其宽度和高度设置为 100% 以适应已设置样式的父对象。

关于html - 带有 Input 元素的 Button 发光效果的 CSS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37567388/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com