如何设置屏幕div右上角图像的位置?
P粉908138620
P粉908138620 2023-09-10 15:33:50
0
1
404

我使用 HTML 和 Django 来创建一个 Web 应用程序。我需要将 div 放在屏幕的右侧。它正在这样做,但它低于其他小部件。它看起来像这样:

我圈出的地方是div所在的位置,但它需要在顶部的右侧。

这是我的 HTML 文件:

<!doctype html>
{% load static %}
{% load crispy_forms_tags %}

<html lang="en" data-bs-theme="dark">
    <head>
        <title>{{object.destination}} in {{trip_length}} days</title>
        <link rel="shortcut icon" type="image/png" href="{% static 'images/favicon.png' %}"/>

        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
        <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
    </head>

    <body id="bg" style="margin:0px">
        {% block content %}
            <div style="background-color: white; height: 100%; padding: 2%;">
                <h1 class="mt-2">{{object.destination}} in {{trip_length}} days</h1>
                <hr class="mt-0 mb-4">
                
                <div style="width: 48%; background-color: white; padding: 2%; border: 1px solid #e5e5e5; border-radius: 3px;">
                    <h3 class="mt-3">Find Places</h3>
                    <hr class="mt-0 mb-4">

                    <form method="post" novalidate>
                        {% csrf_token %}
                        {{ find_places_form|crispyA }}
                        <button type="submit" class="btn btn-primary" style="margin-top: 10px;">Find Places</button>
                    </form>
                </div>

                <div style="width: 48%; background-color: white; padding: 2%; border: 1px solid #e5e5e5; border-radius: 3px; margin-top: 2%;">
                    <h3 class="mt-3">Find Hotels</h3>
                    <hr class="mt-0 mb-4">

                    <form method="post" novalidate>
                        {% csrf_token %}
                        {{ find_hotels_form|crispy }}
                        <button type="submit" class="btn btn-primary" style="margin-top: 10px;">Find Hotels</button>
                    </form>
                </div>
                {% if place_results_name %}
                    <div style="height: 75vh; width: 48%; background-color: white; border: 1px solid #e5e5e5; border-radius: 3px; float:right">
                        <div class="card" style="width: 18rem; padding: 2%; margin: 1%;">
                            <img class="card-img-top" src="{% static 'images/pexels-photo-10768835.jpeg'%}" alt="Card image cap">
                            <div class="card-body">
                                <h5 class="card-title">{{place_results_name}}</h5>
                                <p class="card-text">Place description...</p>
                                <button class="btn btn-primary">Add to Trip</button>
                            </div>
                        </div>
                    </div>
                {% endif %}
            </div>
        {% endblock %}
    </body>
</html>

P粉908138620
P粉908138620

全部回复(1)
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责声明 Sitemap
PHP中文网:公益在线PHP培训,帮助PHP学习者快速成长!