CSS-DIV Expandable Content Box

This is the DIV version to the previous tabular version! Lets get started.

After you're done creating and saving your 3 slices..

.. into your site>images folder, open Notepad or your plain text editor software and type/copy&paste the following HTML code:

Snippet 1

  1. <div class="box_container">

  2. <div class="box_header"></div>

  3. <div class="box_content">

  4. <div class="bodytxt">

  5. Your body text here.

  6. </div>

  7. </div>

  8. <div class="box_footer"></div>

  9. </div> <!--End of box_container-->

Here's the CSS styling

Snippet 2

  1. .box_container{ /*Once you give this a defined width, you can also add margin: auto auto; to centre the container*/

  2. width: 608px;

  3. }

  4. .box_header{

  5. background: url(sd_01.gif) no-repeat;

  6. width: 608px;

  7. height: 56px;

  8. }

  9. .box_content{

  10. background: url(sd_02.gif) repeat-y;

  11. width: 608px;

  12. }

  13. .bodytxt{

  14. font-family: century gothic;

  15. font-size: 10px;

  16. color: #339933;

  17. margin: 0 1em 0 2em; /*Set margin values for top=0, right=1em, bottom="0" left="2"*/

  18. }

  19. .bodytxt p{ /*Remove browser paddings and margins -THIS IS VERY IMPORTANT*/

  20. margin:0;

  21. padding:0;

  22. }

  23. .bodytxt p{

  24. padding: .5em; /*Add your desired paragraph paddings. */

  25. }

  26. .box_footer{

  27. background: url(sd_04.gif) no-repeat;

  28. width: 608px;

  29. height: 28px;

  30. }

Please note that you must remove the paragraph margins or else in browsers like Firefox, there will be a space/gap between the header and the content images and the content and the footer images. Once you remove the margins, you can then give padding values to the p tag.

The final result in action here!