script
element) which includes the following:font
element in the above because essentially you won't be needing it anymore so you might as well just say your goodbyes right now and kick it to the curb once and for all. Meet the span
element which will now take over most of your inline formatting needs.)Property Name | Some Possible Values | What It Does |
---|---|---|
font-family | (Any font name) | Sets the text typeface |
font-size | 15px | 12pt | 0.5em | Sets the text size |
font-weight | bold | normal | Set bold typeface? |
font-style | italic | normal | Set italics typeface? |
background | (Any color) | url('example.jpg') | Sets background |
color | (Any color) | Sets the text color |
line-height | 17px | normal | Sets line spacing |
px
. Example: font-size: 15px;
(a nice size for a font). Use pixels for measurements when you want to closely control the font sizes on your web page. (More about pixels...)pt
. Example: font-size: 12pt;
(a nice size for a font). 1 point is the equivalent of 1/72nd of an inch. Measurements in points are typically used for printed material and hence some web authors feel more comfortable with this because they can 'relate' to it better than using pixels or ems. Be advised, however, that Macintosh and Windows display points measurements measurements differently (Macintosh displays smaller). em
. Example: font-size: 0.5em;
(displays font at half the size of the parent element font). div
element is the parent of the span
element:<div><span style="font-size: 0.5em">This text will be displayed at half of font size of the parent DIV element.</span></div>
em
measurements is to use them throughout the web page so that all font sizes are relative to one another. This is ultimately predicated upon the base font size which is left to be defined by the user (by setting options in his web browser). If the user goes with the default browser settings then the base font size typically defaults to 3 (see font size). Hence em
measurements are ideal for allowing the user define how big the font sizes should be. (Be advised that some users like really big text so this can produce some wacky results.)
font-weight: normal;
- The text is not rendered in bold type face.font-style: normal;
- The text is not rendered in italics.line-height: normal;
- The line height is rendered at what would be reasonable for the font-size being currently applied.span
element is a generic inline HTML element which will essentially replace the font
element as you make the switch from formatting text with HTML to formatting text with CSS. It requires both start and end tags <span>...</span>
, the latter of which does not force a line break in the visible text. In other words, it behaves just like the font
element with the exception that it does not support any special attributes. You will primarily use it with core attributes such as id, class and style to apply CSS properties to the enclosed text.span
element with the style
attribute:<span style="font-family: arial;">Some text...</span>
<font face="arial">Some text...</font>
class
or id
attribute in conjunction with an embedded or external style sheet.
<p style="font-family: verdana; font-size: 15px; font-weight: bold; font-style: italic; background: #ffffcc; color: green; line-height: 18px;">How now brown cow</p>
<style type="text/css">
<!--
p {
font-family: verdana;
font-size: 15px;
font-weight: bold;
font-style: italic;
background: #ffffcc;
color: green;
line-height: 18px;
}
-->
</style>
<p>How now brown cow</p>
How now brown cow
Free Text Editors
Free Graphics Editors
Website Analysis Tools
Free Website Templates
See also:
Best Free Web Hosting
How to Make a Web Page
If you need a .COM web address, you can get one quick and easy at...
INTRO | TOP | NEXT ~> |