This example shows alternative colored rows (tr element). I use a CSS classes to have different background and text colors. The magic is the switch using the modulus (%) operator which decides what CSS class is used inside the currrent row of the MySQL result set.

DigitalOceanSSD Cloud Server from $5/month by DigitalOcean, simple cloud hosting, built for developers. Receive $10 in credits »
ServerPilotServerPilot is the best way to run WordPress and PHP sites on your DigitalOcean servers. First month free »
PHP: Hypertext Preprocessor
What is PHP? PHP is a widely-used general-purpose scripting language that is especially suited for Web development and can be embedded into HTML.
Homepage of the FPDF Library
About: FPDF is a PHP class which allows to generate PDF files with pure PHP, that is to say without using the PDFlib library.
PHP Classes Repository
A place to find PHP classes and also complete applications. All provided information is about object oriented programming.
The phpMyAdmin Project
Official website of the phpMyAdmin Project. phpMyAdmin is a tool written in PHP intended to handle the administration of MySQL over the web.
SitePoint : New Articles, Fresh Thinking for Web Developement
With a vast variety of web design tutorials and articles coupled with a vibrant and well informed community, SitePoint the natural place to go to grow your online business

For this demo we're using table rows instead of the DIV containers in our example. The hover effect is part of the Bootstrap CSS framework.