将2个Divs并排html django



我的问题是我不能将2 divs放在一行中。我无法使用浮点这是我正在使用的代码:

index.html

<!DOCTYPE html>
<html>
<head>
    {% load static %}
    <link rel="stylesheet" type="text/css" href="{% static "Css/indexstyle.css" %}">
    <title>Temporary</title>
</head>
<body>
{% for post in posts %}
    <a href="#"><div class="cl1">
        <img src="{% static 'Img/img.jpg' %}" id="picture">
        <center>{{ post.title}}</center>
        </center>
    </div></a>
{% endfor %}
</body>
</html>

indexstyle.css

.product {
    height: 350px;
    width: 250px;
    background-color: #E5E5E5;
    border-radius: 10px;
    margin-right: 2em;
    float: left;
}
img{
    height: 200px;
    width: 250px;
    border-radius: 10px 10px 0px 0px;
}
a{
    text-decoration : none;
    color: inherit;
}

您应该将div标签与类rowcol一起使用,即使DIV数量未知,也应该并排获得Divs。

最新更新