When I write in the input the text starts to appear in the middle instead of the beginning

Asked

Viewed 396 times

1

I’m quite beginner still in html/css and found no answer anywhere, but then, in the input I put a css to increase the size of "box" etc, but when I write appears the "|" to start writing in a strange position, I wanted q to start at the beginning.

CSS/HTML:

aside {
    background: #ffffff;
    color: white;
    border: 2px #438df2 solid;
    float: left;
    height: 75.56%
}

aside p {
    font-size: 17px;
    font-family: 'Montserrat', sans-serif;
    color: black;
    margin: 15px;
}

.label1, .label2 {
    color: black;
    font-size: 17px;
    font-family: 'Montserrat', sans-serif;
    margin: 15px;
}

#email {
    padding: 0px 35px 10px 50px;
    margin: 0px;
}

#email2 {
    padding: 0px 60px 120px 60px;
    margin: 0px;
}
  <aside>
     <p>Interested in my work? Send me a message!</p>
     
      <label for="email" class="label1">Insert your email here:</label>
      <p>
        <input type="text" id="email" name="Email" class="input1"></p>
        
        <label for="text" class="label2">Insert your message here:</label>
      <p>
        <input type="text" id="email2" name="Text" class="input1"></p>
        
        <button>Send</button>
        
  </aside>
  

1 answer

2


It’s because of the paddings:

#email {
    padding: 0px 35px 10px 50px;
    margin: 0px;
}

#email2 {
    padding: 0px 60px 120px 60px;
    margin: 0px;
}

You can exchange for width and height:

aside {
    background: #ffffff;
    color: white;
    border: 2px #438df2 solid;
    float: left;
    height: 75.56%
}

aside p {
    font-size: 17px;
    font-family: 'Montserrat', sans-serif;
    color: black;
    margin: 15px;
}

.label1, .label2 {
    color: black;
    font-size: 17px;
    font-family: 'Montserrat', sans-serif;
    margin: 15px;
}

#email {
    width: 260px;
    height: 30px;
    margin: 0px;
}

#email2 {
    width: 295px;
    height: 140px;
    margin: 0px;
}
  <aside>
     <p>Interested in my work? Send me a message!</p>
     
      <label for="email" class="label1">Insert your email here:</label>
      <p>
        <input type="text" id="email" name="Email" class="input1"></p>
        
        <label for="text" class="label2">Insert your message here:</label>
      <p>
        <input type="text" id="email2" name="Text" class="input1"></p>
        
        <button>Send</button>
        
  </aside>
  

The second input was quite large, I think what you want is a textarea maybe, see like this:

aside {
    background: #ffffff;
    color: white;
    border: 2px #438df2 solid;
    float: left;
    height: 75.56%
}

aside p {
    font-size: 17px;
    font-family: 'Montserrat', sans-serif;
    color: black;
    margin: 15px;
}

.label1, .label2 {
    color: black;
    font-size: 17px;
    font-family: 'Montserrat', sans-serif;
    margin: 15px;
}

#email {
    width: 260px;
    height: 30px;
    margin: 0px;
}

#email2 {
    width: 295px;
    height: 140px;
    margin: 0px;
}
  <aside>
     <p>Interested in my work? Send me a message!</p>
     
      <label for="email" class="label1">Insert your email here:</label>
      <p>
        <input type="text" id="email" name="Email" class="input1"></p>
        
        <label for="text" class="label2">Insert your message here:</label>
      <p>
        <textarea id="email2" name="Text" class="input1"></textarea></p>
        
        <button>Send</button>
        
  </aside>
  

  • Ahh was just that then ours, but instead of using this textarea I can modify the width and height not? type decrease the height of the second input etc, or those px you put was for some purpose?

  • @Patrickpassarella I did to stay identical to yours, but the pointer does not get in the middle. You can change width: <valor>px; and height: <valor>px; the will.

  • Okay, thank you very much, you solved

  • @Patrickpassarella see that the different textarea of the input, accepts several lines. If the answer solved the problem mark it as correct please. How and why to accept an answer?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.