gpt4 book ai didi

javascript - 如何使类型 ="submit"在 css 中看起来像类型 ="button"

转载 作者:太空宇宙 更新时间:2023-11-04 12:15:24 24 4
gpt4 key购买 nike

我正在尝试制作一个网站来获取和存储有关人或事物的信息。当有人输入用户名并单击按钮时,它会找到标有用户输入内容的目录。如果没有文件,它将转到错误页面。

我遇到的问题是 <input type="button" name="search" value="Search Database">是我想要的样子,但它只有在我更改 type="button" 时才会提交至 type="submit"这改变了 css,所以它看起来很有趣。

请帮我解决按钮问题谢谢,我真的很感激。

<!DOCTYPE html>
<html>

<head>

<meta charset="UTF-8">

<title>Genetics Database</title>

<style>
@import url(http://fonts.googleapis.com/css?family=Exo:100,200,400);
@import url(http://fonts.googleapis.com/css?family=Source+Sans+Pro:700,400,300);

body{
margin: 0;
padding: 0;
background: #fff;

color: #fff;
font-family: Arial;
font-size: 12px;
}

.body{
position: absolute;
top: -20px;
left: -20px;
right: -40px;
bottom: -40px;
width: auto;
height: auto;
background-image: url(http://ginva.com/wp-content/uploads/2012/07/city-skyline-wallpapers-008.jpg);
background-size: cover;
-webkit-filter: blur(5px);
z-index: 0;
}

.grad{
position: absolute;
top: -20px;
left: -20px;
right: -40px;
bottom: -40px;
width: auto;
height: auto;
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(0,0,0,0)), color-stop(100%,rgba(0,0,0,0.65))); /* Chrome,Safari4+ */
z-index: 1;
opacity: 0.7;
}

.header{
position: absolute;
top: calc(50% - 40px);
left: calc(50% - 270px);
z-index: 2;
}

.header div{
float: left;
color: #fff;
font-family: 'Exo', sans-serif;
font-size: 35px;
font-weight: 200;
}

.header div span{
color: #5379fa !important;
}

.login{
position: absolute;
top: calc(50% - 75px);
left: calc(50% - 50px);
height: 150px;
width: 350px;
padding: 10px;
z-index: 2;
}

.login input[type=text]{
width: 250px;
height: 30px;
background: transparent;
border: 1px solid rgba(255,255,255,0.6);
border-radius: 2px;
color: #fff;
font-family: 'Exo', sans-serif;
font-size: 16px;
font-weight: 400;
padding: 4px;
}

.login input[type=password]{
width: 250px;
height: 30px;
background: transparent;
border: 1px solid rgba(255,255,255,0.6);
border-radius: 2px;
color: #fff;
font-family: 'Exo', sans-serif;
font-size: 16px;
font-weight: 400;
padding: 4px;
margin-top: 10px;
}

.login input[type=button]{
width: 260px;
height: 35px;
background: #fff;
border: 1px solid #fff;
cursor: pointer;
border-radius: 2px;
color: #a18d6c;
font-family: 'Exo', sans-serif;
font-size: 16px;
font-weight: 400;
padding: 6px;
margin-top: 10px;
}

.login input[type=button]:hover{
opacity: 0.8;
}

.login input[type=button]:active{
opacity: 0.6;
}

.login input[type=text]:focus{
outline: none;
border: 1px solid rgba(255,255,255,0.9);
}

.login input[type=password]:focus{
outline: none;
border: 1px solid rgba(255,255,255,0.9);
}

.login input[type=button]:focus{
outline: none;
}

::-webkit-input-placeholder{
color: rgba(255,255,255,0.6);
}

::-moz-input-placeholder{
color: rgba(255,255,255,0.6);
}
</style>

<script src="js/prefixfree.min.js"></script>

</head>

<body>

<div class="body"></div>
<div class="grad"></div>
<div class="header">
<div>YouR<span>Genetics</span></div>
<br>
<div> Database</div>
</div>
<br>
<form action="/database/search.php" method="post">
<div class="login">
<br><br>
<input type="text" name="userinfo" placeholder="Username/Keyword" ><br>
<input type="button" name="search" value="Search Database">
</div>

<script src='http://codepen.io/assets/libs/fullpage/jquery.js'></script>

</body>

</html>

最佳答案

您缺少表单 的结束标记。确保包括在内。并将您的 CSS input['submit'] 更改为:input[type=submit],现在您可以将 HTML 按钮更改为键入提交。它应该工作

关于javascript - 如何使类型 ="submit"在 css 中看起来像类型 ="button",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28758145/

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