Friday, July 8, 2011

CSS For Your Form Messages

Continued comments on "Easy PHP Websites With The Zend Framework (2011)" by Jason Gilmore.

On page 72 in Ch. 5, the author notes you can customize the messages of your form. I copied the following code from his companion website that was in public/css/styles.css:

#flash, #errors {
background-color: #0061CE;
color: white;
font-weight: bold;
border: 1px solid black;
width: 50%;
margin: 3px;
padding: 3px;
}

then modified it slightly and pasted it into application/views/scripts/account/login.phtml as:

<html>
<head>
</head>
<style>
ul.errors {
background-color: #0061CE;
color: white;
font-weight: bold;
border: 1px solid black;
width: 50%;
margin: 3px;
padding: 3px;
}
</style>

<body>
<?= $this->form; ?>
</body>

</html>

Now I have the same garrish bold error messages in white against a blue background as the companion website. Whoo-hoo! (No offense, Jason.)

0 comments: