General CSS Document


/ Published in: CSS
Save to your folder(s)



Copy this code and paste it in your HTML
  1. /* GENERAL CSS DOCUMENT */
  2.  
  3. body {
  4. color:#000;
  5. background:#f5f5f5;
  6. font-family:"Helvetica Neue", Arial, Helvetica, sans-serif;
  7. }
  8.  
  9. div#background {
  10. position: absolute;
  11. background: #CCC;
  12. width: 960px; /* reduced to account for padding */
  13. height: 100%;
  14. top: 30px;
  15. left: 50%; /* DIV-BASED CENTERING PART 1 */
  16. margin-left:-490px; /* DIV-BASED CENTERING PART 2 */
  17. padding: 10px; /* enforces distance between DIV edge and contents */
  18. }
  19.  
  20. div#container {
  21. position: relative;
  22. background:#f5f5f5;
  23. height: 80px; /* decreased to account for XXX */
  24. width: 80px; /* decreased to account for XXX */
  25. margin: 10px; /* positions DIV relative to parent container, does not affect actual size */
  26. padding: 10px; /* positions DIV contents relative to interior border, does affect actual size */
  27. /* border: 1px solid black; borders also affect actual size, test by uncommenting*/
  28. float: left;
  29. }
  30.  
  31. /* note how the final position is a mix of background padding and plainbox padding */

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.