Home

How to Create Page Styles for Your HTML5 & CSS3 Template

|
Updated:  
2023-06-28 20:51:25
|
HTML5 and CSS3 All-in-One For Dummies
Explore Book
Buy On Amazon
With an HTML framework in place, you can start working on the CSS to create page styles on your site. The best way to incorporate CSS3 is by following these steps:
  1. Begin with the page template diagram.

    It should have all the information you need.

  2. Test your CSS in a browser.

    Begin with a simple CSS implementation that ensures you have the right names for all the page elements. Then modify each element according to your design document, testing as you go.

  3. Implement the CSS from your diagram.

    You should be implementing the design you already created, not designing the page. (That already happened in the diagramming process.)

  4. Save the design.

    For multi-page projects, external CSS in a separate file is definitely the way to go. As you work, save the CSS in the normal way so the browser will be able to read it.

  5. Test and tweak.

    Things are never quite what they seem with CSS because browsers don't conform to standards equally. You need to test and tweak on other browsers. If users with older technologies are a concern, you may have to use a secondary style sheet for older versions of IE. You may also want to make a mobile version.

  6. Repeat for other templates.

    Repeat this process for each of the other templates you identified in your site diagram.

The result of this process should be a number of CSS files that you can readily reuse across your site.

Here's the CSS code for the primary page:

image0.jpg

body {
 background-color: #000000;
}
h1 {
 text-align: center;
 font-family: sans-serif;
 color: white;
 text-shadow: 0 0 10px black;
}
#all {
 background-color: white;
 border: 1px solid black;
 width: 800px;
 margin-top:2em;
 margin-left: auto;
 margin-right: auto;
 min-height: 600px;
}
#heading {
 background-color: #A11204;
 background-image: url("cbBackground.png");
 color: #FFFFFF;
 height: 100px;
 font-size: 2em;
 padding-left: 1em;
 border-bottom: 3px solid black;
 margin-top: -1.5em;
}
#menu {
 background-image: url("cbBackground.png");
 background-color: #A11204;
 color: #FFFFFF;
 float: left;
 width: 100px;
 min-height: 500px;
}
#menu li {
 list-style-type: none;
 margin-left: -2em;
 margin-right: .5em;
 text-align: center;
}
#menu a {
 color: #FFFFFF;
 display: block;
 border: #A11204 3px outset;
 text-decoration: none;
}
#menu a:hover {
 border: #A11204 3px inset;
}
.content {
 border: 3px double #A11204;
 margin: 1em;
 margin-left: 110px;
 padding-left: 1em;
 padding-bottom: 1em;
 padding-right: 1em;
 border-radius: 5px;
 box-shadow: 5px 5px 5px gray;
}
.content h2 {
 background-color: #A11204;
 background-image: url("cbBackground.png");
 color: #FFFFFF;
 text-align: right;
}
#footer {
 color: #FFFFFF;
 background-color: #000000;
 border: 1px solid #A11204;
 float: left;
 clear: both;
 width: 100%;
 text-align: center;
}

About This Article

This article is from the book: 

About the book author:

Andy Harris earned a degree in Special Education from Indiana University/Purdue University–Indianapolis (IUPUI). He taught young adults with severe disabilities for several years. He also taught himself enough computer programming to support his teaching habit with freelance programming.
Those were the exciting days when computers started to have hard drives, and some computers connected to each other with arcane protocols. He taught programming in those days because it was fun.
Eventually, Andy decided to teach computer science full time, and he still teaches at IUPUI. He lectures in the applied computing program and runs the streaming media lab. He also teaches classes in whatever programming language is in demand at the time. He has developed a large number of online video-based courses and international distance education projects.
Andy has written several books on various computing topics and languages including Java, C#, mobile computing, JavaScript, and PHP/MySQL.
Andy welcomes comments and suggestions about his books. He can be reached at [email protected].