How to apply space in a span element

I am trying to apply one empty space inside a span element, but could not do it.

In my application, I have the following two span elements.

<span style='color:red;margin-right:1.25em'>*</span> <span style='color:red;margin-right:1.25em'>&nbsp;</span> 

I applied these two passes to different fields to get them at the same level of alignment, but I have the following problem. Pfb enter image description here

is there something wrong with the code above

the first name field should move a little to the right for proper alignment.

+4
source share
2 answers

applies to block elements or inline blocks

but not inline element e.g.

span tags

try it

 <span style='color:red;margin-right:1.25em; display:inline-block;'>&nbsp;</span> 
+20
source

Since span elements are built-in elements by default, horizontal fields are ignored for them by the specification. You can make them inline blocks (supported by most, but not all, browsers) or use an add-on instead of a field.

This probably will not solve the final problem, since the symbols β€œ*” and the space without a break do not have the same width, except by accident. To customize a data table consisting of form fields and associated labels and explanations, use an HTML table, and then simply add some CSS styles.

+5
source

All Articles