Your Guide to Professional |
HTML Tips HTML Codes Web Development |
Web Design
Tips JavaScript Codes 216 Web Safe Colors |
CSS
Tutorial JavaScript Tutorial ASCII Character Codes |
| Web Site Development | HTML Codes | HTML Tips | Web Design Tips | Javascript Snippets | 216 Safe Colors | Symbols | CSS Tutorial | JavaScript Tutorial | |
|
Font-family: Arial, Verdana, Georgia, "Times New Roman", Sans-Serif; |
Note that each font face is separated by a comma, and
Times New Roman is in quotation marks, while others are not. Any time you
use a font face that has more than one word in its name separated by spaces,
you must use quotation marks.
Next, define the size of the fonts, either using terms,
such as small, or numbers, such as 1 or +1. It can also be defined in pixels.
Browsers recognize and accept font sizing in a variety of ways.
We will be using pixels within the following example:
Font-size: 12px; |
The spacing between lines can also be defined. If you don't want to define the line spacing, it will naturally be set to 120% of the size of the font. However, if you want more line spacing than that between lines of text, you can specify a different amount.
Line-height: 160% |
Notice that there is no semicolon after 160%. This is
because we are finished defining the body section of the CSS. The final
definition needs no semicolon after it.
The upper portion of your HTML/CSS code should now look like this:
<html> <head> <title>Your Page Title</title> <style type= "text/css" title="styleid" media="all"> <!-- body { background-color: 000000; color: ffffff; margin: 100px; font-family: Arial, Georgia, "Times New Roman", Verdana, Sans-Serif; font-size: 12px; Line-height: 160% } --> </style> </head> <body>
</body> |
You can use CSS to specify how your Head tags should
be formatted. For example, you can specify the font face and color of the
<H1> tag within your web page like this:
H1 { color: ff0000; font-family: Arial, "Times New Roman"; } |
Your HTML code would look like this:
<html> <head> <title>Your Page Title</title> <style type= "text/css" title="styleid" media="all"> <!-- body { background-color: 000000; color: ffffff; margin: 100px; font-family: Arial, Georgia, "Times New Roman", Verdana, Sans-Serif; font-size: 12px; Line-height: 160% } H1 { color: ff0000; font-family: Arial, "Times New Roman"; } --> </style> </head> <body>
</body> |
As you can see, we are still working inside the comment tag of the <style> tags. Now that the H1 definition has been added, anywhere the H1 tag appears within the web page, the color of that text will be red, and it will appear in the Arial font.
With CSS, you can even control the indention of paragraphs and the spacing between letters in words. To define the indention that should be used for each paragraph, include the following code:
P { text-indent: 5em } |
This will cause a five space indention at the beginning of each paragraph.
To specify spacing between letters, use the following example:
P { text-indent: 5em; Letter-spacing: 0.5em } |
Now, the paragraphs will be indented five spaces, and
the spacing between each letter will be half a space. This also works when
defining headings, such as:
H1 {color: ff0000; font-family: Arial, "Times New Roman"; letter-spacing: 0.5em} |
As you are beginning to see, CSS allows you to manipulate all of the text within the page in ways that HTML doesn't allow. In the following lessons, you will learn how to manipulate other HTML tags with CSS.
Previous |
Next |
An Introduction to Cascading Style
Sheets
Creating a Basic HTML Page
Embedding Cascading Style Sheets
Using Cascading
Style Sheets (CSS) to Specify Web Page Formatting
Manipulating Bulleted
and Numbered Lists with Cascading Style Sheets (CSS)
Formatting Hyperlinks
with Cascading Style Sheets (CSS)
Creating Tables within a
Web Page with Cascading Style Sheets (CSS)
Cascading Style
Sheets (CSS) Classes and ID's
Cascading Style Sheet
Codes Chart - Property Index
Cascading Style
Sheets Tutorial: An Introduction to Cascading Style Sheets
JavaScript
Tutorial: An Introduction to JavaScript
Web
Development: A step by step guide to developing a successful Internet
business
HTML
Codes Chart: Copy and paste HTML codes for your web page
HTML Tips:
Copy and paste special effect HTML codes for your web page
Web Design
Tips: Tips, tricks, and special effect codes for your web page
JavaScript
Code Snippets: Copy and paste special effect JavaScript codes for your
web page
216
Web Safe Color Chart: Hexadecimal and RGB Color Codes for your web page
ASCII Character
Codes Chart: American Standard Code for Information
Interchange character codes chart