Lesson 8 Using Font and Text in Web Design
Lesson 8 Using Font and Text in Web Design
Example:
{font-family:”Arial Black”}- specifies a single font using CSS.
{font-family:”Times New Roman”, Georgia, Serif}
What is Font style?
Font style property is mostly used to style a
specific text. Font has several properties to style a text.
This property has three values:
Normal- text appears in normal.
Italic- text appears in italic.
Oblique- text appears leaning (it is similar to italic
but less supported).
Example of font-style
p.normal {
font-style: normal;
}
p.italic {
font-style: italic;
}
p.oblique {
font-style: oblique;
}
To include a boldface style, use the font-weight
attribute in any type of style sheet. Font weight defines the
heaviness of a text.
Using an inline style:
<p style=“font-weight:bold”> This text is in BOLD letters</p>
Using an inline style or external style:
p{font-weight:bold}
Example of font-weight
p.normal {
font-weight: normal;
}
p.thick {
font-weight: bold;
}
Value
h2 {
font-size: 30px;
}
p {
font-size: 14px;
}
Two types of Size
Absolute size Relative Size
Sets the text to a specified Sets the size relative to
text. surrounding elements.
Does not allow a user to Allows a user to change
change the text size in all the text size in browsers.
browsers. Syntax for specifying
Absolute size is useful font size in CSS.
when you know the size of
the output (like the monitor
of your user)
Font-size property
Value Description Value Description
xx-small Smallest possible size x-small 2nd smallest possible
size
small 3rd smallest possible medium The default size
size
large Slightly larger than x-large Larger size than the
the default. default
xx-large Largest font-size smaller One value smaller
than the parent
element
larger One value larger than length Fixed to a specific
the parent element. value in px and cm.
% Larger or smaller in inherit Size the same to the
percent than the parent parent element
element.
Readability of your web content depends on its font size. There
are four common units by which you can measure the size of the text as
it is displayed in the web browser. These are the following:
Pixels (px)- these are fixed size units that are used in a computer
screen or other screen media.
Points (pt)- these are similar to pixels but are fixed in size and are
best used in print media.
Percent (%) this is scalable unit which can be used for mobile
devices and accessibility. By default, a 100% font size is equivalent to
12 pt
Ems (em)- this is also a scalable unit that is used in web document
media. Generally, 1 em =12pt = 16px = 100%
Creating an Inline Span
• A span is a tag that can be placed to any web content to be
formatted.
• It is beneficial if users wish to apply a style to a single word or
a group of words in a single container tag.
• Span is mostly used in inline style called Inline span.
Example:
<p> Cigarette smoking is <span style=“font-weight:bold; font-
style: italic”>Dangerous</span>to your health</p>
In general, space is set to
Adjust Spacing zero; a positive value will
In HTML, there are two types increase the space and a
negative value will
of spacing users can control.
decrease the space.
These are word spacing and
letter spacing. Example of letter spacing
Word spacing manages the p{letter-spacing:2px;}
amount of space between Example of word spacing
each word while letter p{word spacing:20px;}
spacing manages the amount
of space between each letter.
Text Alignment
Alignment is very The text align property specifies
important because it the horizontal alignment of yext
will create a visual in an element.
connection between Basic Syntax:
other web content p{ text-align: center;}
such as images,
videos, and others.
Value Desscription
Text
None Word’s capitalization will
Transform not be changed.
• The text
transform Capitalize First letter of the word is
property controls capitalized.
the capitalization
Uppercase The entire word will be in
of the text. uppercase
Basi Syntax:
Lowercase The entire word will be in
p{text- lowercase
transform:uppercas
e;} Inherit Gives the text case and
capitalization of its parent.
THANK YOU!!!!!