gpt4 book ai didi

html - 如何向我的网页添加两个按钮?

转载 作者:行者123 更新时间:2023-11-28 04:33:56 26 4
gpt4 key购买 nike

我的网站上有一个非常酷的按钮,但是我无法创建多个按钮。我试图找出原因,但找不到问题所在。有人知道怎么了吗?我基本上只想在“主页”按钮的左侧放置另一个名为“联系人”的按钮。谢谢!

html, body {
height: 100%;
}

body {
background: linear-gradient(#000 0%, #121212 100%);
}

.center-wrap1 {
position: absolute;
top: calc(50% - 100px);
left: calc(75% - 125px);
width: 250px;
height: 200px;
}

.center-wrap2 {
position: absolute;
top: calc(20% - 100px);
left: calc(50% - 125px);
width: 250px;
height: 200px;
}

.button {
position: relative;
display: block;
background: none center center no-repeat;
background-size: cover;
border: 2px solid #2e2e2e;
text-transform: uppercase;
letter-spacing: .3rem;
padding: 20px 15px;
text-align: center;
max-width: 270px;
min-width: 200px;
cursor: pointer;
overflow: hidden;
-webkit-transition: border 1s cubic-bezier(0.19,1,.22,1),color .6s cubic-bezier(0.19,1,.22,1);
transition: border 1s cubic-bezier(0.19,1,.22,1), color .6s cubic-bezier(0.19,1,.22,1), background 5s cubic-bezier(0.19,1,.22,1);
}

.button a {
color: #969696;
font-family: 'Varela Round';
text-decoration: none;
}

.button .mask {
background: #fff;
background: rgba(255,255,255,0.5);
}

.button .mask {
position: absolute;
display: block;
width: 200px;
height: 100px;
-webkit-transform: translate3d(-120%,-50px,0) rotate3d(0,0,1,45deg);
transform: translate3d(-120%,-50px,0) rotate3d(0,0,1,45deg);
-webkit-transition: all 1.1s cubic-bezier(0.19,1,.22,1);
transition: all 1.1s cubic-bezier(0.19,1,.22,1);
}

.button .shift {
-webkit-transition: all 1.1s cubic-bezier(0.19,1,.22,1);
transition: all 1.1s cubic-bezier(0.19,1,.22,1);
}

.button:hover {
border-color: #fff;
/* box-shadow: 0 0 5px rgba(255,245,245,0.8); */
/* background-image: url('http://cuinine.com/img/codepen/savvy.jpg'); */
}

.button:hover a {
color: #fff;
}

.button:hover .mask {
background: #fff;
-webkit-transform: translate3d(120%,-100px,0) rotate3d(0,0,1,90deg);
transform: translate3d(120%,-100px,0) rotate3d(0,0,1,90deg);
}

.button:hover .shift {
padding-left: 5px;
}
<!DOCTYPE html>
<html>

<head>

<link href="https://fonts.googleapis.com/css?family=Passion+One" rel="stylesheet">

<link rel = "stylesheet" href = "Style.css">

<meta name = "viewport" content="width = device-width, initial-scale=1">

<title> Website </title>

</head>

<header>
<h1> Website </h1>
</header>

<body>

<link href='http://fonts.googleapis.com/css?family=Varela+Round' rel='stylesheet' type='text/css'>

<div class="center-wrap1">
<div class="button">
<a href="#"> Home <span class="shift"></span></a>
<div class="mask"></div>

<div class="center-wrap2">
<div class="button">
<a href="#"> Contact <span class="shift"></span></a>
<div class="mask"></div>

</div>
</div>
</div>
</body>

</html>

最佳答案

您没有关闭第一个按钮的 <div> .

html,
body {
height: 100%;
}
body {
background: linear-gradient(#000 0%, #121212 100%);
}
.center-wrap1 {
position: absolute;
top: calc(50% - 100px);
left: calc(75% - 125px);
width: 250px;
height: 200px;
}
.center-wrap2 {
position: absolute;
top: calc(20% - 100px);
left: calc(50% - 125px);
width: 250px;
height: 200px;
}
.button {
position: relative;
display: block;
background: none center center no-repeat;
background-size: cover;
border: 2px solid #2e2e2e;
text-transform: uppercase;
letter-spacing: .3rem;
padding: 20px 15px;
text-align: center;
max-width: 270px;
min-width: 200px;
cursor: pointer;
overflow: hidden;
-webkit-transition: border 1s cubic-bezier(0.19, 1, .22, 1), color .6s cubic-bezier(0.19, 1, .22, 1);
transition: border 1s cubic-bezier(0.19, 1, .22, 1), color .6s cubic-bezier(0.19, 1, .22, 1), background 5s cubic-bezier(0.19, 1, .22, 1);
}
.button a {
color: #969696;
font-family: 'Varela Round';
text-decoration: none;
}
.button .mask {
background: #fff;
background: rgba(255, 255, 255, 0.5);
}
.button .mask {
position: absolute;
display: block;
width: 200px;
height: 100px;
-webkit-transform: translate3d(-120%, -50px, 0) rotate3d(0, 0, 1, 45deg);
transform: translate3d(-120%, -50px, 0) rotate3d(0, 0, 1, 45deg);
-webkit-transition: all 1.1s cubic-bezier(0.19, 1, .22, 1);
transition: all 1.1s cubic-bezier(0.19, 1, .22, 1);
}
.button .shift {
-webkit-transition: all 1.1s cubic-bezier(0.19, 1, .22, 1);
transition: all 1.1s cubic-bezier(0.19, 1, .22, 1);
}
.button:hover {
border-color: #fff;
/* box-shadow: 0 0 5px rgba(255,245,245,0.8); */
/* background-image: url('http://cuinine.com/img/codepen/savvy.jpg'); */
}
.button:hover a {
color: #fff;
}
.button:hover .mask {
background: #fff;
-webkit-transform: translate3d(120%, -100px, 0) rotate3d(0, 0, 1, 90deg);
transform: translate3d(120%, -100px, 0) rotate3d(0, 0, 1, 90deg);
}
.button:hover .shift {
padding-left: 5px;
}
<!DOCTYPE html>
<html>

<head>

<link href="https://fonts.googleapis.com/css?family=Passion+One" rel="stylesheet">

<link rel="stylesheet" href="Style.css">

<meta name="viewport" content="width = device-width, initial-scale=1">

<title>Website</title>

</head>

<header>
<h1> Website </h1>
</header>

<body>

<link href='http://fonts.googleapis.com/css?family=Varela+Round' rel='stylesheet' type='text/css'>

<div class="center-wrap1">
<div class="button">
<a href="#"> Home <span class="shift"></span></a>
<div class="mask"></div>
</div>
</div>

<div class="center-wrap2">
<div class="button">
<a href="#"> Contact <span class="shift"></span></a>
<div class="mask"></div>
</div>
</div>

</body>

</html>

关于html - 如何向我的网页添加两个按钮?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41596947/

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