5
I want to know how I can remove these spaces:
So that the span
and the input
stay together, like here:
My CSS:
input, textarea {
background: none repeat scroll 0 0 #FFFFFF;
border: 1px solid #C9C9C9;
color: #545658;
padding: 8px;
font-size: 14px;
border-radius: 2px 2px 2px 2px;
}
.input-group-addon {
padding: 8px 12px;
font-size: 14px;
font-weight: 400;
line-height: 1;
color: #555;
text-align: center;
background-color: #eee;
border: 1px solid #EEEEEE;
}
MY HTML:
<div class="input-group1">
<span class="input-group-addon" id="basic-addon1">Nome</span>
<input type="text" name="name" class="input_name" />
<span class="input-group-addon" id="basic-addon1">Email</span>
<input type="text" name="email" class="input_email" />
</div>
<div class="input-group1">
<span class="input-group-addon" id="basic-addon1">Empresa</span>
<input type="text" name="empresa" class="input_empresa" />
<select name="state" class="btn" data-width="76" data-value="Funcionários">
<option value="">Funcionários</option>
<option value="">------</option>
</select>
</div>
<div class="input-group1">
<span class="input-group-addon" id="basic-addon1">Cidade</span>
<input type="text" name="cidade" class="input_cidade" />
<input type="hidden" name="form_input" value="FORM_COTACAO" />
<select name="state" class="btn" data-width="76" data-value="UF*">
<option value="">UF</option>
<option value="AC">AC</option>
<option value="AL">AL</option>
<option value="AP">AP</option>
<option value="AM">AM</option>
<option value="BA">BA</option>
<option value="CE">CE</option>
<option value="DF">DF</option>
<option value="ES">ES</option>
<option value="GO">GO</option>
<option value="MA">MA</option>
<option value="MT">MT</option>
<option value="MS">MS</option>
<option value="MG">MG</option>
<option value="PA">PA</option>
<option value="PB">PB</option>
<option value="PR">PR</option>
<option value="PE">PE</option>
<option value="PI">PI</option>
<option value="RJ">RJ</option>
<option value="RN">RN</option>
<option value="RS">RS</option>
<option value="RO">RO</option>
<option value="RR">RR</option>
<option value="SC">SC</option>
<option value="SP">SP</option>
<option value="SE">SE</option>
<option value="TO">TO</option>
</select>
<span class="input-group-addon" id="basic-addon1">Telefone</span>
<input type="text" name="telefone" class="input_telefone" />
<div class="input-group">
</div>
</div>
I know I could easily make the form using bootstrap, but I was asked not to use it in this project.
Probably your input or span is margin. Try adding
margin: 0
. In developer tools (both FF and Chrome), in the "Elements" tab there is the option to see a selected element in box format. In this format of boxes, are displayed padding, width, height and margins computed. So you can know exactly which one is causing the space. Personally, I find it more likely that jsea theinput
.– Vinícius Gobbo A. de Oliveira
Shortest path: Remove any space or line breaks between these elements in your HTML. This occurs with elements inline and inline-block.
– bfavaretto
@Wineusgobboa.deOliveira Thank you for the comment and explanation!
– GWER
@bfavaretto It worked right! I never imagined it would be this, thank you very much!
– GWER
@GWER Put the solution he found as answer.
– Renan Gomes
this problem is very annoying... in SO-en you have a question with several interesting solutions: http://stackoverflow.com/questions/1097006/removaing-whitespace-between-html-elements-when-using-line-breaks
– Daniel Omine