Answer the question
In order to leave comments, you need to log in
Ul li and python django?
Hello. Can django affect css?
Here are the codes -
models
class Tag(models.Model):
name = models.CharField(verbose_name='Название тега', max_length=50, default='')
alias = models.SlugField(verbose_name='Alias тега', default='')
def __str__(self):
return self.name
class Meta:
verbose_name = 'Tag'
verbose_name_plural = 'Tags'
def mainPage(request):
tag = Tag.objects.all()
return render(request, 'mainPage/index.html', locals())
<div class="tags">
{% for value in tag %}
<ul>
<li><a href="">{{value.name}}</a></li>
</ul>
{% endfor %}
</div>
.tags{
width: 100%;
height: 100px;
margin: 15px auto;
text-align: center;
}
.tags ul{
text-align:center;
}
.tags li{
display:inline-block;
margin: 5px 10px;
cursor: pointer;
transition: all .2s ease-in-out;
text-align: center;
border-radius: 3px;
background-color: #44c1b9;
}
.tags li:hover{
transform: scale(0.95);
}
.tags a{
display: block;
padding: 10px;
font-size: 17px;
}
Answer the question
In order to leave comments, you need to log in
<div class="tags">
{% for value in tag %}
<ul>
<li><a href="">{{value.name}}</a></li>
</ul>
{% endfor %}
</div>
<ul class="tags">
{% for value in tag %}
<li><a href="">{{value.name}}</a></li>
{% endfor %}
</ul>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question