Reputation: 81
I can't write on all the input space. When I create the line (not a box because I removed the left-right-top border) and put padding, I can't write on the full line, only on half of it, and then the previous text will disappear on the left side.
.contato {
background-color: white;
width: 75%;
height: 80%;
margin-left: auto;
margin-right: auto;
margin-top: 10%;
}
.contato .header {
background-color: #353E49;
border-style: solid;
border-color: lightgrey;
border-bottom: none;
border-width: 0.5px;
}
.contato h1 {
margin-left: 10%;
color: white;
padding: 5% 0 5% 0;
font-family: "lato regular";
letter-spacing: 2px;
font-size:
}
input,
textarea {
display: block;
background: transparent;
border: none;
border-bottom: 1px solid #CECFD3;
padding: 1.5% 50% 2% 0;
resize: vertical;
width: auto;
font-family: "Lato Regular";
color: darkgray;
font-size: 1.05 rem;
}
.preencher {
border-style: solid;
border-color: lightgrey;
border-width: 0.5px;
border-top: none;
padding-top: 5%;
margin-top: -5%;
}
<div class="contato">
<form name="contato" method="POST" netlify>
<div class="header">
<h1>Contato</h1>
</div>
<div class="preencher">
<p>
<label>Nome: <input type="text" name="nome"></label>
</p>
<p>
<label>E-mail: <input type="email" name="email"></label>
</p>
<p>
<label>Empresa/site: <input cols="60" type="email" name="empresa"></label>
</p>
<p>
<label>Mensagem: <textarea name="mensagem"></textarea></label>
</p>
<p>
<button type="submit">Send</button>
</p>
</div>
</form>
</div>
You can see the result on jsfiddle and understand better what I said: https://jsfiddle.net/cLsgL3d1/
Any ideas?
Upvotes: 0
Views: 195
Reputation: 304
I just modified this code and it works fine now:
input,textarea {
display:block;
background: transparent;
border: none;
border-bottom: 1px solid #CECFD3;
padding: 1.5% 0 2% 0; // you have added 50% of right padding. which is the reason of the problem.
resize:vertical;
width:100%;
font-family:"Lato Regular";
color:darkgray;
font-size:1.05 rem;
}
Upvotes: 0
Reputation: 1305
You need to add/replace this CSS to your existing code:
input { width: 100%; padding: 1.5% 5% 2% 0; box-sizing: border-box; }
Your 50% right padding is what is causing the input to allow such a small amount of text. If you are wanting the input to stop before the right edge of the container, I'd suggest adding padding-right to the parent
tags.
Upvotes: 1
Reputation: 903
Your input padding
is set to 50% and your width is set to auto, which is causing your width
to be 50% and margin
to be fill the rest of the space. Change your left/right padding to zero (or whatever), and set your width to 100% rather than auto.
.contato {
background-color:white;
width:75%;
height:80%;
margin-left:auto;
margin-right:auto;
margin-top:10%;
}
.contato .header {
background-color: #353E49;
border-style:solid;
border-color:lightgrey;
border-bottom:none;
border-width: 0.5px;
}
.contato h1 {
margin-left:10%;
color:white;
padding:5% 0 5% 0;
font-family:"lato regular";
letter-spacing: 2px;
font-size:
}
input,textarea {
display:block;
background: transparent;
border: none;
border-bottom: 1px solid #CECFD3;
padding: 1.5% 0 2% 0;
resize:vertical;
width:100%;
font-family:"Lato Regular";
color:darkgray;
font-size:1.05 rem;
}
.preencher {
border-style: solid;
border-color:lightgrey;
border-width: 0.5px;
border-top:none;
padding-top:5%;
margin-top:-5%;
}
<div class="contato">
<form name="contato" method="POST" netlify>
<div class="header">
<h1>Contato</h1>
</div>
<div class="preencher">
<p>
<label>Nome: <input type="text" name="nome"></label>
</p>
<p>
<label>E-mail: <input type="email" name="email"></label>
</p>
<p>
<label>Empresa/site: <input cols="60" type="email" name="empresa"></label>
</p>
<p>
<label>Mensagem: <textarea name="mensagem"></textarea></label>
</p>
<p>
<button type="submit">Send</button>
</p>
</div>
</form>
</div>
Upvotes: 1