Css
Css
h1 {
font-size: 40px;
}
body {
font-size: 100%;
}
h1{
font-size:10vw;
}
Font-Size Property
<style>
body {
font-size: 100%;
}
h1 {
font-size: 2.5em;
}
h2 {
font-size: 1.875em;
}
Font-Size Property
p{
font-size: 10vw;
}
</style>
</head>
<body>
<h1>This is heading 1</h1>
<h2>This is heading 2</h2>
<p>This is a paragraph.</p>
<p>An example of the font-size</p>
</body>
Font-weight Property
The font-weight property specifies the weight of a font
<style>
p.normal {
font-weight: normal;
}
p.light {
font-weight: lighter;
}
p.thick {
font-weight: bold;
}
Font-weight Property
p.thicker {
font-weight: 900;
}
</style>
</head>
<body>
<h1>The font-weight property</h1>
<p class="normal">This is a paragraph.</p>
<p class="light">This is a paragraph.</p>
<p class="thick">This is a paragraph.</p>
<p class="thicker">This is a paragraph.</p>
</body>
Font-style Property
• The font-style property is mostly used to specify italic text
• This property has three values:
normal - The text is shown normally
italic - The text is shown in italics
oblique - The text is "leaning" (oblique is very similar to
italic, but less supported)
Example:
<style>
p.normal {
font-style: normal;
}
Font-style Property
p.italic {
font-style: italic;
}
p.oblique {
font-style: oblique;
}
</style>
Font-style Property
</head>
<body>
</body>
</html>
Font-variant Property
• The font-variant property specifies whether or not a text
should be displayed in a small-caps font
• In a small-caps font, all lowercase letters are converted to
uppercase letters
• However, the converted uppercase letters appears in a
smaller font size than the original uppercase letters in the text
Font-variant Property
<html>
<head>
<style>
p.normal {
font-variant: normal;
}
p.small {
font-variant: small-caps;
}
</style>
</head>
Font-variant Property
<body>
</body>
</html>
Font-stretch Property
• The font-stretch property allows you to make text narrower
(condensed) or wider (expanded)
Example:
<html>
<body>
<p style = "font-stretch:ultra-expanded;"> If this doesn't
appear to work, it is likely that your computer doesn't have a
<br>condensed or expanded version of the font being used.
</p>
</body>
</html>
Font-stretch Property
Value Description
ultra- Makes the text as narrow as it gets
condensed
extra- Makes the text narrower than condensed,
condensed but not as narrow as ultra-condensed
condensed Makes the text narrower than semi-
condensed, but not as narrow as extra-
condensed
semi- Makes the text narrower than normal, but
condensed not as narrow as condensed
normal Default value. No font stretching
Font-stretch Property
semi-expanded Makes the text wider than normal, but
not as wide as expanded
expanded Makes the text wider than semi-
expanded, but not as wide as extra-
expanded
extra-expanded Makes the text wider than expanded,
but not as wide as ultra-expanded
ultra-expanded Makes the text as wide as it gets
initial Sets this property to its default value
inherit Inherits this property from its parent
element
Font-size-adjust Property
• The font-size-adjust property gives one better control of the
font size when the first selected font is not available
• When a font is not available, the browser uses the second
specified font
• This could result in a big change for the font size so in order
to prevent this, one can use the font-size-adjust property
• All fonts have an "aspect value" which is the size-difference
between the lowercase letter "x" and the uppercase letter "X"
• When the browser knows the "aspect value" for the first
selected font, the browser can figure out what font-size to use
when displaying text with the second choice font
Syntax: body
{
text-align: alignment type;
}
The vertical-align Property
• The vertical-align property sets the vertical alignment of an
element
• The text can be set to baseline, top, bottom and super or
sub alignment
Syntax: body
{
vertical-align: alignment type;
}
The text-indent Property
• This property can be used to decorate the text
• It can be defined by using underline, over line, line-through or
none property
• Syntax: body
{
text-decoration: decoration type;
}
To set the text decoration of the line:
text-decoration: underline red wavy 10px;
Tip of the day: If you want to not include the line in the link tag
then just make the text-decoration: none.
The text-indent Property
• Text indentation property is used to indent the first line of the
paragraph
• The size can be in px, cm, pt.
• Syntax: body
{
text-indent: size;
}
The text-shadow Property
• The text-shadow property adds shadow to text
• In its simplest use, one only specify the horizontal shadow
(2px) and the vertical shadow (2px)
• One can specify the horizontal size, vertical size and shadow
color for the text and blur effect too
• Syntax:
body
{
text-shadow: horizontal-size vertical-size blur-value
color- name;
}
The text-transform Property
• Text transformation property is used to change the case of
text, uppercase or lowercase
• Text transformation can be uppercase, lowercase or
capitalize
• Capitalize is used to change the first letter of each word to
uppercase
• Syntax:
body
{
text-transform: type;
}
The letter-spacing Property
• This property is used to specify the space between the
characters of the text
• The size can be given in px
• Syntax:
body
{
letter-spacing: size;;
}
The word-spacing Property
• Word spacing is used to specify the space between the
words of the line
• The size can be given in px
• Syntax:
body
{
word-spacing: size;
}
The white-space Property
• The white-space property specifies how white-space inside
an element is handled
• Syntax:
body
{
white-space: nowrap;
}
The direction Property
• Text direction property is used to set the direction of the text
• The direction can be set by using rtl : right to left
• Left to right is the default direction of the text
• Syntax:
body
{
direction: rtl;
}
The unicode-bidi property is used together with the direction
property to set or return whether the text should be overridden
to support multiple languages in the same document