Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

55
Views
border-spacing issue with span element

How can i add space between this borders? Border-spacing is not working.

Borders

 {{#each spacing}}
<span class='space'>
  {{business}} ({{Count}})
</span>
{{/each}}

CSS

.space{
  border: 1px solid gray;
 border-spacing: 10px;
} 
about 4 years ago · Juan Pablo Isaza
3 answers
Answer question

0

border-spacing

border-spacing only applies to table cells. If you want to use your span with that specific style property you have to set its parent display to table and the span itself to table-cell.

div{
  border-spacing: 10px;
  display: table
}

span{
  border: 1px solid red;
  display: table-cell
}
  <div>
    <span>a</span>
    <span>b</span>
  </div>

margin

Another way would be to add a margin. Yet be aware of the excess margin on the last element, which might not always be desired.

.spacer{
  border: 1px solid gray;
  margin-right: 20px;
}

/*REM: Remove margin on last element*/
.spacer:last-of-type{
  margin-right: 0
}
<span class = 'spacer'>a</span>
<span class = 'spacer'>b</span>
<b>c</b>

about 4 years ago · Juan Pablo Isaza Report

0

border-spacing only sets the distance between the borders of adjacent cells in a . You don't have a table here, so the command doesn't work! You need to set the padding. In your case: padding: 10px;

about 4 years ago · Juan Pablo Isaza Report

0

You can use margin instead

.space {
 border: 1px solid gray;
 margin: 0 5px 0 0;
} 
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!