BLOGS BY TOPIC
BLOGS BY AUTHOR
BLOGS BY YEAR
This is the second of a three-part online training series of blogs on CSS style sheets. This blog shows how to create styles for specific HTML tags (the first part covers the principles of CSS style sheets, and the third part gives a worked example of CSS).
- CSS Styles for Specific HTML Tags (this blog)
- Block Elements (Heading, Div and Paragraph Tags)
- Inline Tags - Span, Em and Strong
- Styling Images - the IMG Tag
- Styles for Ordered and Unordered Lists - ul, ol and li
- Hyperlinks (the A Tag)
- Table Styles
- Setting CSS for Other Tags in HTML
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.
CSS Styles for Specific HTML Tags
A previous blog has given an introduction to the theory of CSS style sheets. This blog shows how to create styles to apply formatting for specific HTML tags, while a final blog gives a full worked example of using CSS to format a website.
To understand this blog, you should be familiar with the main tags in HTML.
The BODY Tag
Styles applied to the BODY tag will affect every page of your website, since every page is contained within a BODY section:
You can't really create an HTML page without putting it in a BODY section!
Here's a typical style for the BODY tag:
/* general styles*/
font:13px Verdana, Arial, Helvetica, sans-serif;
What this specifies is that:
- The background colour of the page will be #DEF (pale blue);
- The standard font size will be 14 pixels, and the typeface will be Verdana (or the closest font your browser can find);
- There will be no margin round the page, and no padding within it;
- Text on the page will be left-aligned by default.