BLOGS BY TOPIC
BLOGS BY AUTHOR
BLOGS BY YEAR
Sometimes online training in style sheets isn't enough: you need a tutorial which takes you through the thought processes involved in creating styles for a web page, step by step. This blog gives a full worked example (you may find it helpful first to look at the two previous parts of this CSS tutorial, on the >principles of CSS and applying styles to HTML tags).
- A Full Worked Example of CSS for a Website
- Two Guiding Principles in Using CSS for a Website (this blog)
- Creating the Page Template
- Setting Styles for HTML Tags
- Specific Class Styles
- Formatting Tables and Gridviews using CSS
Posted by Andy Brown on 16 May 2012
You need a minimum screen resolution of about 700 pixels width to see our blogs. This is because they contain diagrams and tables which would not be viewable easily on a mobile phone or small laptop. Please use a larger tablet, notebook or desktop computer, or change your screen resolution settings.
Two Guiding Principles in Using CSS for a Website
There are 2 decisions you can make to make your life easier as a website developer.
Create a Fixed Width Container
Virtually every large website is contained in a fixed width container (I've just checked Microsoft, Dell and Yahoo, and they all follow this rule). Consider the Wise Owl site at the time of writing:
The Wise Owl site at the time of writing this blog, with notes.
Every page of the website is contained in a fixed width container 900 pixels wide, so that it will display in the same way on old-fashioned monitors as on new screens.
I'm going to assume throughout this blog that you're designing for laptops and desktop computers, not mobile devices (although the principles are the same for both).
Use a White Background for the Main Content
You can do whatever you like with the area around your page. For example, this style would repeat an image across and down the page:
font:13px Verdana, Arial, Helvetica, sans-serif;
background:#0082C3 url(shading.gif) repeat-x;
However, make sure that the content of the page itself has a white background:
Using a white background will make it easier to read your site and add images.
The test is the same: if most other large-scale websites do something, there's probably a very good reason for it!
With these two guiding principles out of the way, it's time to start laying out our page.