Home > Net >  How can i reduce the spacing between checkboxes rendering in a django template?
How can i reduce the spacing between checkboxes rendering in a django template?

Time:11-04

I have retrived some data by retreival from database and saved in into variable DATA `

def sendApproval(request):
    form = SendApp
    data = Profile.objects.filter(Admin="Lavanya")
    context = { "form": form,"data":data}
    return render(request, 'homePageHtml/SendApproval.html', context)

` And then in the html templete I used that data to represent it as checkboxes

`

{%for a in data%}<br>
  <input type="checkbox" id="recommender" name="choosen" value="{{a.UserName}}" >
  <label for="recommender" style="font-size:15px"> {{a.UserName}}</label><br><br>
{%endfor%}

`

and after viewing it on web page it is visible like this: I wanted to reduce the gap between these checkboxes

Any one with the solution will be appreciated! Thanks in advance

I tried:

`

.adjust-line-height {
  line-height: 1em;
}

` adding this into my code, but this didn't work....

CodePudding user response:

I believe that you can reduce the < br > amount in the HTML part, something like:

{%for a in data%}<br>
<input type="checkbox" id="recommender" name="choosen" value="{{a.UserName}}" >
<label for="recommender" style="font-size:15px"> {{a.UserName}}</label><br>
{%endfor%}
  • Related