Css: how to get spaces between two labels on the same line?

I am trying to display multiple labels with fair space between them on the same line in an html document. It works. How to do it better?

<div>
firstlabel &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp secondlabel

</div>
+9
source share
8 answers

You can wrap your tags in tags <span>, give them classes, and add them marginusing CSS.

Example here: http://jsfiddle.net/peduarte/Rf5kB/

HTML

<div>
    <span class="firstLabel">firstlabel</span>
    <span class="secondLabel">secondlabel</span>
</div>

CSS

.firstLabel {
    margin-right: 50px;
}
+14
source

Try the following:

<div class="main">
    <div class="left">firstlabel</div>
    <div class="right">secondlabel</div>
</div>

.main{
   width:220px;
    }
.left{
    width:110px;
    float:left;
    text-align:left;
    }
.right{
    width:110px;
    float:right;
    text-align:right;
    }
+1
source

& nbsp.

<div>
firstlabel &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; secondlabel
</div>
0

&nbsp;, (;). , , , , - <span> css, , , peduarte.

0

, . <p>-Tags , ?

0

, ; &nbsp; ( nyarlathotep). . - CSS, .

<div><span style="padding-right: 5em">firstlabel</span>secondlabel</div>

You can adjust the correct value using any units that are appropriate for your context. But, as a rule, the em module is most suitable, since this means that the interval automatically scales when the font size changes.

0
source

I am surprised that no one suggested a simple inline style: <div style="margin-right: 500px;">firstlabel</div>

0
source
<label >Subscription Expiry: 2019=04-30 00:00:00<br><br></label>     

Type of subscription: paid

0
source

All Articles