Message Boxes with CSS

— Following the line of the previous post, here is another set of reusable classes I like to use. This time to create Message Boxes which I found myself using in almost every site I make, mostly on the forms. These Message Boxes are useful to display and inform in a nice way different messages, like announcements, alerts, or status information. I like to keep things simple so i use a very clean style:

→ Styles Demo: view the demo | ↓ Download

CSS classes:

Nothing too fancy or complicated. I use a main class .message-box , and then the different style variations separated, but just to dont repeat code and keep things more organized:

/* MESSAGE BOXES
/////////////////////////////*/

.message-box { text-align: center; padding: 5px; color:#545454; width:80%;  margin:5px auto; }

.clean { background-color: #efefef; border-top: 2px solid #dedede; border-bottom: 2px solid #dedede; }
.info  { background-color: #f7fafd; border-top: 2px solid #b5d3ff; border-bottom: 2px solid #b5d3ff; }
.ok    { background-color: #d7f7c4; border-top: 2px solid #82cb2f; border-bottom: 2px solid #82cb2f; }
.alert { background-color: #fef5be; border-top: 2px solid #fdd425; border-bottom: 2px solid #fdd425; }
.error { background-color: #ffcdd1; border-top: 2px solid #e10c0c; border-bottom: 2px solid #e10c0c; }

How to use them:

It is very easy to implement them, you have to first add the message-box class and then the wanted style class ( .clean, .info, .ok, .alert or .error ) to the element you want to use as message box. I tend to use a <p> element to display them:

<p class="message-box info">This is an Info Message</p>

<p class="message-box ok">This is an Ok Message</p>

<p class="message-box alert">This is an Alert Message</p>

<p class="message-box error">This is an Error Message</p>
→ Styles Demo: view the demo | ↓ Download

And thats it. Simple but nice looking! I hope you enjoyed.

Tags: , , ,

  • del.icio.us
  • description
  • Design Float
  • Technorati
  • Reddit
  • StumbleUpon
  • E-mail this story to a friend!
Friday, July 25th, 2008 Web Design

→ If you find this post useful please consider inviting me a cup of tea :) Thanks!

6 COMMENTS

  1. Great Post! Concise and to the point. If only ALL tech bloggers were like you lol. The Web would be sweeet!

  2. Niche P on July 27, 2008
  3. It’s very elementary but practical tut. I like it! Thanks

  4. Mohsen on July 28, 2008
  5. I appreciate your comments, Thank you!

  6. Matt on July 29, 2008
  7. Good color choices

  8. Dan on September 9, 2008
  9. I like it! Thanks!

  10. Alice on September 9, 2008
  11. Hey! This is so good!

  12. Marcus Sá on Today

1 TRACKBACK

  1. [...] Visit Source. [...]

  2. Message Boxes with CSS | DesignM.ag on September 9, 2008

Leave a Reply

About Me

Matt Varone - Matias Varone - sksmatt
HI there,

I'm a freelance creative Web developer, UI designer and WordPress lover.

Advertise here

  • WooThemes - Premium WordPress Themes Club
  • Elegan Themes
  • Theme Forest
  • Flash Eden

Twitter Status

Flickr Gallery

  • Clutter drawer
  • CS4 Replacement icons
  • CS4 Replacement icons
  • Magic

Scrnshots Gallery

  • ScrnShot
  • ScrnShot
  • ScrnShot
  • ScrnShot

Last.fm albums

  1. cd cover
  2. cd cover
  3. cd cover
  4. cd cover