Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6559811
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:22:42+00:00 2026-05-25T13:22:42+00:00

I’m really new to HTML and CSS, so this is probably a really basic

  • 0

I’m really new to HTML and CSS, so this is probably a really basic question:

Let’s say I have a page where I’m displaying books (with all the information associated with a book- like an image, name, isbn). Sometimes I’ll have 1 book, other times I’ll have 3 or 6 and so forth.

I know how to display one book using CSS and HTML, but how do I display and position multiple books? I want the first book to appear at the top of the page and subsequent books to appear below it – how do I achieve this?

The information is coming from a database and is on the HTML page through a Django template – so I have template tags like {{ author|safe }} that holds each (in this case) author’s name.

This is the code that I have in the Django template:

<html>
<head>
<body>
<h1>Testing the class page backend</h1>

<ul>
{% for edition in editions %}
    <li>{{ edition|safe }}</li>
{% endfor %}
{% for image in images %}
    <li>{{ image|safe }}</li>
{% endfor %}
{% for author in authors %}
    <li>{{ author|safe }}</li>
{% endfor %}
{% for book_title in book_titles %}
    <li>{{ book_title|safe }}</li>
{% endfor %}
</ul>

</body> 

</html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T13:22:43+00:00Added an answer on May 25, 2026 at 1:22 pm

    I’m a bit confused by your Django template code. You say you can have any number of books displayed on the page. What context are you passing to your Django template?

    Judging from your template code, it seems like you’ve got separate lists for each property — one list for all the images of all the books, one list for all the authors, etc.

    I would have thought it would make more sense to have a list of book objects, where each book has its properties as, y’know, properties. E.g.

    <ul>{% for book in books %}
        <li>
            <h2>{{ book.title|safe }}</h2>
    
            <p>by {{ book.author|safe }}</p>
    
            <p>{{ book.image }}</p>
    
    
            <h3>Editions</h3>
    
            <ul>{% for edition in book.editions %}
                <li>{{ edition|safe }}</li>
            </ul>
        </li>{% endfor %}
    </ul>
    

    Of course, that might not make sense for your back-end, but at the moment I can’t quite see what your problem actually is.

    Edit:

    I think I understand your context now. This really isn’t an HTML issue, it’s a Django template issue. Because you’ve got separate lists for each property of your books (instead of a list of book objects), you need to loop through those indexes. Because the Django template language doesn’t have a built-in equivalent of Python’s range function, you’d have to either use a custom template tag, or pop a list of the indexes into your context (e.g. context['indexes'] = len(context['editions'])).

    But I would have thought it’d be a bit more Django-y just to pass a list of book objects to your template, as I suggested above.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
this is what i have right now Drawing an RSS feed into the php,
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have some data like this: 1 2 3 4 5 9 2 6
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I have a French site that I want to parse, but am running into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.