What is the best way to showcase movies and television shows next to each other?

Is it possible to showcase Movies and TV shows side by side using django_bootstrap? Specifically, I want the Movies on the left side and the TVs on the right side. However, I'm unsure of how to achieve this layout.

I currently have code that displays the Movies and TVs using Django's for loop. The HTML code is provided below, but I am still in the process of working on the CSS styling.

<h1>TV Score_by</h1>
<div class="row">

    {% for m in movie %}
        <div class="card" style="width: 18rem;">
            <img src="https://image.tmdb.org/t/p/w200{{ m.poster_path }}" class="card-img-top" alt="...">
            <div class="card-body">
            {% if not m.name %}
                <h5 class="card-title">{{ m.title }}</h5>
            {% else %}
                <h5 class="card-title">{{ m.name }}</h5>
            {% endif %}
            <p class="card-text">{{ m.overview }}</p>
            <a href="/movie/{{ m.id }}/" class="btn btn-primary">View Details</a>
            </div>
        </div>
    {% endfor %}
</div>
<h1>TV Score_by</h1>
<div class="row">
    {% for m in tv %}
        <div class="card" style="width: 18rem;">
            <img src="https://image.tmdb.org/t/p/w200{{ m.poster_path }}" class="card-img-top" alt="...">
            <div class="card-body">
            {% if not m.name %}
                <h5 class="card-title">{{ m.title }}</h5>
            {% else %}
                <h5 class="card-title">{{ m.name }}</h5>
            {% endif %}
            <p class="card-text">{{ m.overview }}</p>
            <a href="/tv/{{ m.id }}/" class="btn btn-primary">View Details</a>
            </div>
        </div>
    {% endfor %}
</div>

Answer №1

Utilize the columns feature for structuring your layout.

<h1>TV Score_by</h1>
<div class="row">
<div class="col">
    {% for m in movie %}
        <div class="card" style="width: 18rem;">
            <img src="https://image.tmdb.org/t/p/w200{{ m.poster_path }}" class="card-img-top" alt="...">
            <div class="card-body">
            {% if not m.name %}
                <h5 class="card-title">{{ m.title }}</h5>
            {% else %}
                <h5 class="card-title">{{ m.name }}</h5>
            {% endif %}
            <p class="card-text">{{ m.overview }}</p>
            <a href="/movie/{{ m.id }}/" class="btn btn-primary">View Details</a>
            </div>
        </div>
    {% endfor %}
</div>
<h1>TV Score_by</h1>
<div class="col">
    {% for m in tv %}
        <div class="card" style="width: 18rem;">
            <img src="https://image.tmdb.org/t/p/w200{{ m.poster_path }}" class="card-img-top" alt="...">
            <div class="card-body">
            {% if not m.name %}
                <h5 class="card-title">{{ m.title }}</h5>
            {% else %}
                <h5 class="card-title">{{ m.name }}</h5>
            {% endif %}
            <p class="card-text">{{ m.overview }}</p>
            <a href="/tv/{{ m.id }}/" class="btn btn-primary">View Details</a>
            </div>
        </div>
    {% endfor %}
</div>
</div>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Understanding the `DOMNodeInserted` event listener can be incredibly useful for pinpointing changes within Iframe contents

On my website, there is an iframe that loads content and I am trying to find the element that comes after it has finished loading. This is the function I used: $("body").on("DOMNodeInserted", ".issueContentIframe", function() { $(this).css('border& ...

Enhance User Interaction by Making HTML Elements Clickable on Top of Three.js Render

I'm currently working on an animation project using Three.js that involves moving objects. In this animation, I've created a text bubble that appears when an object is clicked, along with an "X" button to close it. However, I'm facing an iss ...

What is the best way to create a border that surrounds a collection of pictures?

I'm currently facing a challenge in getting a border to perfectly fit around a collection of images. The issue can be observed in this Jsfiddle I shared, where the border aligns with the top and left edges, but not with the bottom and right edges. Her ...

Background images flanking both sides

What is the solution to making this function properly? <html> <head> <style type="text/css"> .left { float: left; background-image: url('image_with_variable_width.png'); background-repeat: repeat-y; } .right { float: right; bac ...

Creating a Authentic Screw Top Appearance with CSS

I am striving to create a realistic screw head. Here is what I have done so far: <div class="screw"><div class="indent"></div></div> .screw { position: absolute; top: 10px; left: 49%; width: 30px; height: 30px ...

In Internet Explorer 11, border-radius creates a separation between elements

There is an issue with whitespace appearing around elements that have a border-radius larger than 0, but this only occurs in Internet Explorer. If using border-top-left-radius: 20px; and border-top-right-radius: 20px;: https://i.sstatic.net/MAKsx.png *W ...

Mix div borders with varying border radius for child elements

I'm currently working on a project that involves creating border lines between divs to achieve a design similar to the one shown in this design jpeg. However, I've only managed to reach an output jpeg where the merging is not quite right. The C ...

A guide to properly closing and unmounting a Bootstrap Modal using React.js Portals

My current project involves creating a modal that will display all the data from a table row when clicked. Although I have successfully implemented the modal to appear, I am facing an issue with closing it after it is displayed. Initially, I believed the ...

Is it possible to customize the appearance of ordered list numbers using javascript?

Is it possible to change the color of a specific line number in an ordered list using JavaScript? I am familiar with CSS styling such as li::marker, but curious about altering individual list item markers dynamically through JavaScript. How can this be ach ...

Serializing Many-to-Many Fields in Django Rest Framework

Types: class ResourceAttribute(models.Model): """ Represents a resource attribute. Attributes: name (CharField): The name of the resource attribute. """ class Meta: verbose_name = "Re ...

Having difficulties with hovering over a td that has a rowspan

I am encountering some challenges when attempting to hover over a td with rowspan in my HTML table. Despite searching for a solution, I have not been successful. I came across suggestions on forums that hinted at using JS/jQuery. Could someone please provi ...

Step-by-step guide to applying a CSS class to a grid cell using Syncfusion

Is there a way to define a specific style for a cell using the Syncfusion grid grouping control? I attempted the code below, but it doesn't seem to be effective in my webform. tdescriptor.Columns[0].Appearance.AnyRecordFieldCell.CssClass = "hideColum ...

Exploring the power of Django Rest Framework's reverse method in conjunction with Simple

When utilizing DRF's reverse to access a complex URL from SimpleRouter, how can I do it? The URL is specified in two locations, one for teams and one for games: In league.urls: url(r'^team/', include('teams.urls')), In team.url ...

Adjusting image width using jQuery

I have been experimenting with creating a Webgl hover effect for an image. The effect works well, but now I am trying to specify a width for the image within jQuery. new hoverEffect({ parent: document.querySelector('.ticket'), intensity1: 0. ...

Django error: Invalidly set SECRET_KEY in the configuration

Encountering an error while running the migrate command 'python manage.py migrate' on macOS results in the following traceback: Traceback (most recent call last): File "manage.py", line 10, in <module> execute_from_command_line(sys.a ...

When an HTML page is hosted on an external server, its formatting may

I recently put together an HTML page that incorporates some CSS and two simple highcharts from highcharts.com. After testing the page on my local machine and being satisfied with the outcome, I transferred it to a server on our internal network to make it ...

Ensure that all elements with the :hover event have a text color of #fff in CSS

 Troubleshooting problems with block's child elements during the :hover event. Specifically, I have a pricing block where I want all texts to be of color #fff when hovered over. Currently, when hovering over the <h3> and <p> elements ...

CSS delays affecting the loading of the page's display

I am currently working on a WordPress website and I have noticed that one of the CSS files takes approximately 10 seconds to load, causing a significant delay in displaying the page. I am looking for ways to speed up this loading process. As part of my ef ...

Create an animation that transitions a line from 0% width to 100% width, moving from left to right

Desiring to create a pseudo-element line that expands from left to right across its container, then contracts from right to left back to zero width. Note: in my JavaScript code, I apply the "underlined-animated" class after a specific timeout. I've e ...

Nothing is being returned when using JQuery AJAX POST

Having trouble identifying the issue, as all that seems to happen is the URL changes to "http://localhost/?search=test" when entering "test", for example. index.php <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquer ...