CSS3 introduces several new text properties we can use to style text.
In CSS3, we can use the text-shadow
property applies shadow to text.
text-shadow
accepts a comma-separated list of shadows to be
applied to the text.
<!DOCTYPE html>
<html>
<head>
<style>
h1 {<!-- w w w . j av a2 s . com-->
text-shadow: 10px 10px 10px #CCC;
}
</style>
</head>
<body>
<h1>Text-shadow effect!</h1>
</body>
</html>
The code above is rendered as follows:
In CSS3, we can use the word-wrap
property
to force the text to wrap in the middle of a word.
Its possible values are
<!DOCTYPE html>
<html>
<head>
<style>
p.test {<!--from ww w . ja v a 2s . co m-->
width: 11em;
border: 1px solid #000000;
word-wrap: break-word;
}
</style>
</head>
<body>
<p class="test">
This paragraph contains a very long
word: thisisaveryveryveryveryveryverylongwooooooooooooooooooord.
The long word will break and wrap to the next line.
The long word will break and wrap to the next line.</p>
</body>
</html>
The code above is rendered as follows:
The text-overflow
property in CSS3
determines how to signal overflowed content to the users.
It can be clipped, or display an ellipsis '...' or a user-defined string.
It accepts the following values.
<!DOCTYPE html>
<html>
<head>
<style>
div {<!-- w ww . j av a 2s. c o m-->
white-space: nowrap;
width: 100%;
overflow: hidden; /* "overflow" value must be different from "visible" */
text-overflow: ellipsis;
}
</style>
</head>
<body>
<div>
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
</div>
</body>
</html>
The code above is rendered as follows: