0

I am dealing with an issue that seems very simple but can't resolve it in any way I can. I have a textbox followed by a comma.

.nospace {
  letter-spacing: -1px;
  margin: 0;
  padding: 0;
  margin-left: 0;
  margin-right: 0;
  word-spacing: 0;
}
<span class="nospace">
          <asp:TextBox ID="userInfo1" runat="server" CssClass="extension_textbox2 nospace"/>
           <span style="margin: 0;padding: 0;margin-left:0;word-spacing:0">,</span>
</span>

I don't want any space between the textbox and a comma but for some reason the space doesn't go away despite setting the margins and paddings to 0. I did try font-size=0 but that setting removes ability to enter any text into a textbox. Also, I saw some suggestions to use float left, but that setting moves comma or textbox to a beginning of a paragraph. How can I safely remove the space between the comma and a textbox?

Thank you in advance

Mr. Developer
  • 129
  • 11
James
  • 1,081
  • 4
  • 15
  • 34
  • 1
    Does it help to remove the whitespace between the `` element and your text box? – Mori Mar 03 '22 at 10:26
  • If you use `.nospace * { float: left; }` it will not show the space. The space is caused by the whitespace (i.e., it's on a separate line) between the textbox and the inner span. – Andrew Morton Mar 03 '22 at 10:33
  • Another way would be to use `.nospace { display: inline-flex; }`, as also shown in the Q&A I proposed as a duplicate of this one. – Andrew Morton Mar 03 '22 at 10:35
  • Try adding this and give nospace class only in parent div .nospace { margin: 0; padding: 0; margin-left: 0; margin-right: 0; word-spacing: 0; display: flex; gap: 0px; flex-direction: row; } – PHP Geek Mar 03 '22 at 11:16
  • 1
    display: inline-flex; worked!!!! Thank you very much! – James Mar 03 '22 at 11:26

0 Answers0