I am attempting to create a contact form for my online store and I ran into a bug, when I try to type inside my text fields the website wont allow me to do so.
I have tried a couple of things but they were not much help. I have yet to add any JavaScript but I am not sure if that is the root of my problem or its something simple.
* {
margin: 0;
padding: 0;
font-family: 'poppins', sans-serif;
box-sizing: border-box;
}
.hero {
background: #1d2026;
min-height: 100vh;
width: 100%;
color: #fff;
position: relative;
}
nav {
display: flex;
align-items: center;
}
nav .menu {
width: 50px;
margin-right: 20px;
cursor: pointer;
padding-bottom: 50px;
}
nav .logo {
width: 500px;
height: 200px;
object-fit: none;
padding-right: 80px;
padding-bottom: 55px;
}
nav ul {
flex: 1;
text-align: right;
margin-right: 20px
}
nav ul li {
display: inline-block;
list-style: none;
margin-right: 20px;
padding-bottom: 100px;
font-size: 25px;
margin: 0 20px;
}
nav ul a {
text-decoration: none;
color: #fff;
}
.lamp-set {
position: absolute;
top: -20px;
left: 22%;
width: 200px;
}
.lamp {
width: 100%;
}
.light {
position: absolute;
top: 97%;
left: 50%;
transform: translateX(-50%);
width: 700px;
margin-left: -10px;
opacity: 1;
}
.text-container {
max-width: 1000px;
margin-top: 2%;
margin-left: 50%;
}
.text-container h1 {
font-size: 80px;
font-weight: 400;
display: inline-block;
color: #fff;
}
.text-container p {
font-size: 40px;
font-weight: 200;
display: inline-block;
color: #fff;
margin-top: 10px;
}
.emails {
background: #00a8f3;
padding: 14px 40px;
display: inline-block;
color: #fff;
font-size: 25px;
margin-top: 30px;
margin-left: 50%;
border-radius: 30px;
}
.villian {
background: #1d2026;
min-height: 100vh;
width: 100%;
color: #fff;
position: relative;
}
.text-contact {
max-width: 1000px;
margin-top: 2%;
margin-left: 50%;
}
.text-contact h1 {
font-size: 50px;
font-weight: 400;
display: inline-block;
color: #fff;
}
.text-shop h1 {
font-size: 80px;
font-weight: 400;
display: inline-block;
color: #fff;
margin-left: 50%;
}
.text-contact p {
font-size: 40px;
font-weight: 200;
display: inline-block;
color: #fff;
margin-top: 10px;
}
.container {
display: flex;
align-items: center;
justify-content: center;
}
form {
background: #fff;
display: flex;
flex-direction: column;
padding: 2vw 4vw;
width: 90%;
max-width: 600px;
border-radius: 10px;
}
form h3 {
color: #555;
font-weight: 800;
margin-bottom: 20px;
text-decoration: none;
}
form input,
form textarea {
border: 0;
margin: 10px 0;
padding: 20px;
outline: none;
background: #f5f5f5;
font-size: 16px;
}
form button {
padding: 15px;
background: #00a8f3;
color: #fff;
font-size: 18px;
border: 0;
outline: none;
cursor: pointer;
}
a:link {
text-decoration: none;
}
a:visited {
text-decoration: none;
}
a:hover {
text-decoration: none;
}
a:active {
text-decoration: none;
}
<div >
<nav>
<img src="menu.png" >
<img src="ovlogo.png" >
<ul>
<li><a href="index.html">Home</li>
<li><a href="contact.html">contact</li>
</ul>
</nav>
<div >
<form>
<h3>Get in touch</h3>
<input type="text" id="name" placeholder="Your name" required>
<input type="email" id="email" placeholder="Email" required>
<input type="text" id="phone" placeholder="Phone number" required>
<textarea id="message" rows="4" placeholder="How can we assist you?"></textarea>
<button type="submit">Submit</button>
</form>
</div>
</div>
CodePudding user response:
You forgot to close your a
tag so the whole page was a link which means if you click on anything contained in that link (virtually everything below the tag), it will reload the page
Fix is to add </a>
to close it.
* {
margin: 0;
padding: 0;
font-family: 'poppins', sans-serif;
box-sizing: border-box;
}
.hero {
background: #1d2026;
min-height: 100vh;
width: 100%;
color: #fff;
position: relative;
}
nav {
display: flex;
align-items: center;
}
nav .menu {
width: 50px;
margin-right: 20px;
cursor: pointer;
padding-bottom: 50px;
}
nav .logo {
width: 500px;
height: 200px;
object-fit: none;
padding-right: 80px;
padding-bottom: 55px;
}
nav ul {
flex: 1;
text-align: right;
margin-right: 20px
}
nav ul li {
display: inline-block;
list-style: none;
margin-right: 20px;
padding-bottom: 100px;
font-size: 25px;
margin: 0 20px;
}
nav ul a {
text-decoration: none;
color: #fff;
}
.lamp-set {
position: absolute;
top: -20px;
left: 22%;
width: 200px;
}
.lamp {
width: 100%;
}
.light {
position: absolute;
top: 97%;
left: 50%;
transform: translateX(-50%);
width: 700px;
margin-left: -10px;
opacity: 1;
}
.text-container {
max-width: 1000px;
margin-top: 2%;
margin-left: 50%;
}
.text-container h1 {
font-size: 80px;
font-weight: 400;
display: inline-block;
color: #fff;
}
.text-container p {
font-size: 40px;
font-weight: 200;
display: inline-block;
color: #fff;
margin-top: 10px;
}
.emails {
background: #00a8f3;
padding: 14px 40px;
display: inline-block;
color: #fff;
font-size: 25px;
margin-top: 30px;
margin-left: 50%;
border-radius: 30px;
}
.villian {
background: #1d2026;
min-height: 100vh;
width: 100%;
color: #fff;
position: relative;
}
.text-contact {
max-width: 1000px;
margin-top: 2%;
margin-left: 50%;
}
.text-contact h1 {
font-size: 50px;
font-weight: 400;
display: inline-block;
color: #fff;
}
.text-shop h1 {
font-size: 80px;
font-weight: 400;
display: inline-block;
color: #fff;
margin-left: 50%;
}
.text-contact p {
font-size: 40px;
font-weight: 200;
display: inline-block;
color: #fff;
margin-top: 10px;
}
.container {
display: flex;
align-items: center;
justify-content: center;
}
form {
background: #fff;
display: flex;
flex-direction: column;
padding: 2vw 4vw;
width: 90%;
max-width: 600px;
border-radius: 10px;
}
form h3 {
color: #555;
font-weight: 800;
margin-bottom: 20px;
text-decoration: none;
}
form input,
form textarea {
border: 0;
margin: 10px 0;
padding: 20px;
outline: none;
background: #f5f5f5;
font-size: 16px;
}
form button {
padding: 15px;
background: #00a8f3;
color: #fff;
font-size: 18px;
border: 0;
outline: none;
cursor: pointer;
}
a:link {
text-decoration: none;
}
a:visited {
text-decoration: none;
}
a:hover {
text-decoration: none;
}
a:active {
text-decoration: none;
}
<div >
<nav>
<img src="menu.png" >
<img src="ovlogo.png" >
<ul>
<li><a href="index.html">Home</li>
<li><a href="contact.html">contact</a></li>
</ul>
</nav>
<div >
<form>
<h3>Get in touch</h3>
<input type="text" id="name" placeholder="Your name" required>
<input type="email" id="email" placeholder="Email" required>
<input type="text" id="phone" placeholder="Phone number" required>
<textarea id="message" rows="4" placeholder="How can we assist you?"></textarea>
<button type="submit">Submit</button>
</form>
</div>
</div>