4

This is the image which shows my problem >> https://i.stack.imgur.com/MLJSa.jpg << Here's my html code:

.form-control {
    width: 600px;
    fill: none;
    background: transparent;
    border: none;
    border-bottom: 1px solid grey;
    font-size: 18px;
    margin-bottom: 16px;
}
<form id="contactForm" method="POST" action="">
  <input name="fName" type="text" class="form-control" placeholder="What should I call you? Person X?" required>
  <br>
  <input name="email" type="email" class="form-control" placeholder="Only, if you want to be emailed back">
  <br>
</form>

Thank you for reading this ;)

SuperDJ
  • 7,488
  • 11
  • 40
  • 74
Adrian
  • 67
  • 1
  • 1
  • 8
  • It looks like there is styling applied when the input element is in a `focus` or `active` state. – Anthony Jul 03 '18 at 15:13

3 Answers3

6

As I mentioned in a comment, it looks like a background is being set when the input is in a certain state. It looks like your using a framework and it is impossible to tell without the code used there, or a codepen/jsfiddle.

The css below will set the background to transparent when the input is in focus or active states.

.form-control:focus, .form-control:active {
    background: transparent;
}

Check out this question for information on input states.

Anthony
  • 1,667
  • 2
  • 17
  • 28
  • Thank you very much! Your solution has helped! I'm using Bootstrap(latest version), that's the only framework I'm using. (Or bootstrap isn't a framework, correct me if I'm wrong) Thank you again! :D – Adrian Jul 03 '18 at 18:45
0

In css code instead you can add

background-color:transparent;
0

Try this

form{
  background: #000;
}
.form-control {
    width: 600px;
    fill: none;
    background: transparent;
    border: none;
    border-bottom: 1px solid gray;
    font-size: 18px;
    margin-bottom: 16px;
}


input:focus {
    background-color: #fff;
    border: 2px solid #000;
    padding: 20px;
    border-radius: 10px;
}
<form id="contactForm" method="POST" action="">
  <input name="fName" type="text" class="form-control" placeholder="What should I call you? Person X?" required>
  <br>
  <input name="email" type="email" class="form-control" placeholder="Only, if you want to be emailed back">
  <br>
</form>
Suraj Libi
  • 515
  • 2
  • 9
  • My problem has been fixed, thanks to Anthony, although coming back to your solution, it does not make a difference. Still same error, although thanks. – Adrian Jul 03 '18 at 18:46