How to Change css in php loop output to achieve typographical and line feed effects

Source: Internet
Author: User
How can I change css in php loop output to achieve the effect of typographical layout and line feed? for example, I want to achieve this effect. several pieces of data are extracted from the database and each piece of data is put into a div, each div is a cell in it, with four rows and four rows. when the four cells are automatically arranged in the next loop, css is encountered. I don't know how to deal with css? The idea is how to change css to achieve the effect of layout and line feed during php loop output.
For example, if I want to achieve this, I will retrieve several pieces of data from the database, and put each piece of data into a div. each div is a grid in it, with four rows in one row, enough to automatically route the four cells to the next row

When I encountered css during the loop, I don't know what to do with css? Thoughts


This is the case now.






$ Value ['item _ name']

1212 votes
Vote




Share:
------ Solution --------------------
The page width can be fixed, the width of each element block is fixed, the element block is set to float, and css is used to ensure that each line is exactly four. In this way, each element block can be output cyclically.
------ Solution --------------------
You can output $ key to determine the line feed by judging the key value. for example, if you want to display four lines, when if $ key/4 = 0, end the div and start the new div. good luck to you.
------ Solution --------------------
Float floating

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.