How can I change css in php loop output to achieve typographical and line feed effects?

Source: Internet
Author: User
How can css be changed during php loop output to achieve typographical and line feed effects? for example, if I want to achieve this effect, several pieces of data are taken from the database and each piece of data is put into a p file, each p is a cell in it, with four rows. it is enough for the four cells to automatically route 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


Reply to discussion (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.

You can output $ key to determine the line feed by judging the key value. for example, if you want to display four lines, end p when if $ key/4 = 0

And start the new p

Good luck

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.