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

  • SEARCH
  • Home
  • 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 6784289
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:58:21+00:00 2026-05-26T16:58:21+00:00

I have images read out of a database by Python in the form for

  • 0

I have images read out of a database by Python in the form

for i in images:
    print >> htmlpage, "<img src='../folder/%s'>" % i

giving me an output on a static html-page like

<img src='../folder/image01.jpg'>
<img src='../folder/image02.jpg'>
<img src='../folder/image03.jpg'>
<img src='../folder/image04.jpg'>

I would like the images to be displayed in a grid of five columns. I have tried to do position them in a <table> during output but could not get a working syntax with all <tr> and <td>s. I was wondering if I could just put them in a <div> and let my .css Stylesheet handling the grid-layout?

I don’t know what could be the most elegant solution, generating a well-formatted but simple html-page generated by Python-code? I hope someone has a clue, hint, trick.

Thanks a lot in advance!

  • 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-26T16:58:22+00:00Added an answer on May 26, 2026 at 4:58 pm

    If all images have the same width you could wrap all the images in a container, give the container a width equal to the images width*5 and float the images. Check this fiddle: http://jsfiddle.net/YDUsz/

    I don’t know python, so this might be stupid, but hopefully you’ll get what I mean:

    <div clas="image-wrapper">
    for i in images:
        print >> htmlpage, "<img src='../folder/%s'>" % i
    </div>
    

    CSS:

    .image-wrapper {
        width: (Image width * 5);
    }
    .image-wrapper img {
        float: left;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If we have a website with multiple images and videos, I've read that it's
I have an images folder with a png in it. I would like to
I have 2 images inside a folder called Pics..... Image1.jpg and Image2.jpg. What code
I have stored some images in database, while retrieving them i want to resize
I have a simple form that uploads an image to a database. Using a
I have a stylesheet which defines default width for images. When I read the
I have an SQLite Database in which I am storing images as BLOB using
I have images stored in GridFS for MongoDB. When I pull the image out,
I have a FAT12 image file and I have to open it and read
How do I read an image in C so that I can have direct

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.