|
Options on Text Formatting
|
|
Breaking Words
|
When the browser is asked to display text of a paragraph, it
checks the width available to the element. Whenever a line of text gets to the
end of a line, the browser interrupts the line of text and continues the
paragraph to the next line. The length of the last word on the line influences
where the line is interrupted.
|
One approach used in word processing is to indicate to the
application whether it should "break" the last word on the line or leave it "as
is". In reality, this operation depends on the human language being used. Still,
to let you suggest this operation to the browser, CSS provides a style named
word-break. Its values can be:
- normal: The word cannot be broken. The line break will be done
after the last word on the line
- break-all: Whether the paragraph is justified or not, every word at
the end of the line would be split up to the last letter that can fit at the
end of the line. Here are two examples:
<html>
<head>
<title>Social Science Studies</title>
<style>
.main-title {
text-align: center;
font-weight: bold;
color: Red;
font-size: 0.86cm;
font-family: Bodoni MT Black, Georgia, Times New Roman, serif;
}
.sub-title {
text-align: left;
color: Blue;
font-size: 0.64cm;
font-family: Georgia, Times New Roman, serif;
}
.introduction {
word-break: break-all;
text-align: justify;
color: Black;
font-family: Georgia, Garamond, Times New Roman, serif;
}
.contribution {
word-break: break-all;
text-align: left;
color: Black;
font-family: Georgia, Garamond, Times New Roman, serif;
}
.paragraph {
text-align: justify;
color: Black;
font-family: Georgia, Garamond, Times New Roman, serif;
}
</style>
</head>
<body>
<p class="main-title">Social Science Studies</p>
<p class="sub-title">Introduction</p>
<p class="introduction">Social sciences cover a wide range of studies that
address all types of topics about human beings, their behaviors, their
history, their societies, and their environments. Regular social science
areas include sociology, psychology, philosoply, linguistics, communication,
history, geography, demography, ethnicity, anthropology, archaeology,
political science, law, education, criminology, and economy, just to name
a few. Some social science topics are grouped in categories, such as
individual or crowd, where studies tend to address the same categorical
isssues. Still, social sciences are highly interchangeable. Sometimes,
differences are a matter of interpretations based on the particular
area(s) being considered.</p>
<p class="sub-title">Social Science Contributions</p>
<p class="contribution">Social sciences are not strictly confined to the
above list. Studies in chemistry borrow concepts from sociology, anthropology,
and economy. Mathematics and medicine, that are sometimes said not to be a
science, regularly share theories with philosophy, psychology, or criminology.
In the same way, it is practically impossible to study computer science,
which includes computer languages and application programming, without
referring to linguistics. As a conclusion, social sciences are not restricted
to one area of study but contribute to various types of sciences, studies,
and disciplines.</p>
<p class="sub-title">Recommendations</p>
<p class="paragraph">If you are planning to study any of the scocial science
topics, find a good school.</p>
<p>Schools | Majors | Minors</p>
<p>Copyright © 2015</p>
</body>
</html>
This would produce:
- keep-all: If the paragraph is not justified, nothing would happen.
Assuming that the paragraph is justified, no word will be split. The browser
would check what words, and how many words, can fit on the line. Every line
must be filled up to the last word that can fit. Here is an example:
<html>
<head>
<title>Social Science Studies</title>
<style>
.main-title {
text-align: center;
font-weight: bold;
color: Red;
font-size: 0.86cm;
font-family: Bodoni MT Black, Georgia, Times New Roman, serif;
}
.sub-title {
text-align: left;
color: Blue;
font-size: 0.64cm;
font-family: Georgia, Times New Roman, serif;
}
.introduction {
word-break: keep-all;
text-align: justify;
color: Black;
font-family: Georgia, Garamond, Times New Roman, serif;
}
.contribution {
word-break: keep-all;
text-align: left;
color: Black;
font-family: Georgia, Garamond, Times New Roman, serif;
}
.paragraph {
word-break: keep-all;
text-align: justify;
color: Black;
font-family: Georgia, Garamond, Times New Roman, serif;
}
</style>
</head>
<body>
<p class="main-title">Social Science Studies</p>
<p class="sub-title">Introduction</p>
<p class="introduction">Social sciences cover a wide range of studies that
address all types of topics about human beings, their behaviors, their history,
their societies, and their environments. Regular social science areas
include sociology, psychology, philosoply, linguistics, communication, history,
geography, demography, ethnicity, anthropology, archaeology, political science,
law, education, criminology, and economy, just to name a few. Some social
science topics are grouped in categories, such as individual or crowd, where
studies tend to address the same categorical isssues. Still, social sciences
are highly interchangeable. Sometimes, differences are a matter of
interpretations based on the particular area(s) being considered.</p>
<p class="sub-title">Social Science Contributions</p>
<p class="contribution">Social sciences are not strictly confined to the above
list. Studies in chemistry borrow concepts from sociology, anthropology, and
economy. Mathematics and medicine, that are sometimes said not to be a science,
regularly share theories with philosophy, psychology, or criminology. In the
same way, it is practically impossible to study computer science, which
includes computer languages and application programming, without referring to
linguistics. As a conclusion, social sciences are not restricted to one area
of study but contribute to various types of sciences, studies, and
disciplines.</p>
<p class="sub-title">Recommendations</p>
<p class="paragraph">If you are planning to study any of the scocial science
topics, find a good school.</p>
<p>Schools | Majors | Minors</p>
<p>Copyright © 2015</p>
</body>
</html>
This would produce:
Text Shadow
A shadow can be added to text to decorate it either to
accentuate its effect or to decoarate it. To let you show a shadow on text. CSS
provides the text-shadow style. This value can be set to none, in
which case the shadow must not be displayed. Otherwise, if you want a shadow,
provide a list of 2 to 4 HTML-based numbers and an optional color as the value
of the style:
- The first value is the distance by which to draw the shadow horizontally:
- If you want the shadow to appear on the left side, set a negative
value.
- If you want the shadow to appear on the right side, set a positive
value.
Here is an example:
<html>
<head>
<title>Risk Management</title>
<style>
#risk {
color: red;
font-size: 0.82cm;
font-family: Rockwell, Bodoni MT Black, Elephant, sans-serif; }
#shadowed {
color: red;
font-size: 0.82cm;
text-shadow: 0.15cm 0 0;
font-family: Rockwell, Bodoni MT Black, Elephant, sans-serif; }
#presentation {
font-size: 0.42cm;
font-family: Times New Roman, Garamond, serif; }
</style>
</head>
<body>
<p id="risk">Risk Management</p>
<p id="shadowed">Risk Management</p>
<p id="presentation">After designing a project or defining a problem that
needs a solution, risk management is the ability to identify problems, to
assess their hazards, and to create a plan to address those problems in
order to reduce the likelihood of bad occurrences.</p>
</body>
</html>
This would produce:
- The second value is the distance by which to draw the shadow vertically:
- If you want the shadow to appear on the top side, set a negative
value.
- If you want the shadow to appear on the bottom side, set a positive
value.
Here is an example:
<html>
<head>
<title>Risk Management</title>
<style>
#risk {
color: red;
font-family: Rockwell, Bodoni MT Black, Elephant, sans-serif;
font-size: 0.82cm; }
#shadowed {
color: red;
font-family: Rockwell, Bodoni MT Black, Elephant, sans-serif;
font-size: 0.82cm;
text-shadow: 0 0.15cm 0; }
#presentation {
font-family: Times New Roman, Garamond, serif;
font-size: 0.42cm; }
</style>
</head>
<body>
<p id="risk">Risk Management</p>
<p id="shadowed">Risk Management</p>
<p id="presentation">After designing a project or defining a problem that needs a
solution, risk management is the ability to identify problems, to assess their
hazards, and to create a plan to address those problems in order to reduce the
likelihood of bad occurrences.</p>
</body>
</html>
This would produce:
If you want the shadow to appear on a corner, set both the first and the
second values non-zero
- The combination of the first and the second values set the angle by which
to draw the shadow. The third value is a type of brush, also referred to as a
blur, that will "currupt" the drawing of the shadow so it would appear
blurred. The lower the value, the more solid the shadow. The higher the value,
the more blurry the shadow would appear. Here is an example:
<html>
<head>
<title>Risk Management</title>
<style>
#risk {
color: red;
font-family: Rockwell, Bodoni MT Black, Elephant, sans-serif;
font-size: 0.82cm; }
#shadowed {
color: red;
font-family: Rockwell, Bodoni MT Black, Elephant, sans-serif;
font-size: 0.82cm;
text-shadow: 0.15cm 0.15cm 0.15cm; }
#presentation {
font-family: Times New Roman, Garamond, serif;
font-size: 0.42cm; }
</style>
</head>
<body>
<p id="risk">Risk Management</p>
<p id="shadowed">Risk Management</p>
<p id="presentation">After designing a project or defining a problem that needs a
solution, risk management is the ability to identify problems, to assess their
hazards, and to create a plan to address those problems in order to reduce the
likelihood of bad occurrences.</p>
</body>
</html>
This would produce:
- The fourth value is optional. It represents the color by which the shadow
should be drawn. If you don't specify it, the browser will use the color of
the element to draw the shadow. If you want the shadow to appear in a color
different from the text of the element, pass the 4th value as a
color. Here is an example:
<html>
<head>
<title>Risk Management</title>
<style>
#risk {
color: red;
font-family: Rockwell, Bodoni MT Black, Elephant, sans-serif;
font-size: 0.82cm; }
#shadowed {
color: red;
font-family: Rockwell, Bodoni MT Black, Elephant, sans-serif;
font-size: 0.82cm;
text-shadow: 0.15cm 0.15cm 0.15cm Blue; }
#presentation {
font-family: Times New Roman, Garamond, serif;
font-size: 0.42cm; }
</style>
</head>
<body>
<p id="risk">Risk Management</p>
<p id="shadowed">Risk Management</p>
<p id="presentation">After designing a project or defining a problem that
needs a solution, risk management is the ability to identify problems, to
assess their hazards, and to create a plan to address those problems in
order to reduce the likelihood of bad occurrences.</p>
</body>
</html>
This would produce:
Letter Spacing
Both the operating system and the browser(s) in the
visitor's computer are equipped to display text with some default
characteristics. One way you can change this is to indicate that you want the
letters to be separated by a certain distance. To let you do this, CSS provides
a style named letter-spacing. Its value can be set to
normal, in which case no change would be made. Otherwise, to separate the
letters in an element, specify an HTML-based number as the value of this
attribute. Here is an example:
<html>
<head>
<title>Risk Management</title>
<style>
#rm {
color: Navy;
font-family: Rockwell, Bodoni MT Black, Elephant, sans-serif;
font-size: 0.86cm;
text-shadow: 0.10cm 0.10cm 0.12cm Blue; }
#presentation {
font-family: Times New Roman, Garamond, serif;
font-size: 0.42cm;
letter-spacing: 0.18cm; }
</style>
</head>
<body>
<p id="rm">Risk Management</p>
<p id="presentation">After designing a project or defining a problem that needs
a solution, risk management is the ability to identify problems, to assess their
hazards, and to create a plan to address those problems in order to reduce the
likelihood of bad occurrences.</p>
</body>
</html>
This would produce:
|
|