Return to Snippet

Revision: 38582
at January 5, 2011 12:30 by danielwrobert


Initial Code
<body id="<?= basename($_SERVER['PHP_SELF'], ".php")?>">

Initial URL
http://css-tricks.com/id-your-body-for-greater-css-control-and-specificity/

Initial Description
From an awesome comment on how you can use PHP to apply the unique ID to to the body element. This will return the name of the PHP file being executed as the ID (e.g. body id="index.php"). To leave off the .php part, just remove the ".php" part.

Initial Title
Add a unique ID to to the body element with PHP

Initial Tags
php

Initial Language
PHP