42 views
How to set the color of the text.
<html>
<head>
<style type=”text/css”>
h1 {color: #FFFF99}
h2 {color: #CCFFFF}
p {color: rgb(0,0,255)}
</style>
</head>
<body>
<h1>This is text</h1>
<h2>This is text 2</h2>
<p>This is a paragraph</p>
</body>
</html>
How to set the background-color of a part of the text.
<html>
<head>
<style type=”text/css”>
span.text1
{
background-color:yellow
}
</style>
</head>
<body>
<p>
<span class=”text1″>This is a text.</span> This is a text. This is a text. <span class=”text1″>This is a text.</span>
</p>
</body>
</html>
How to increase or decrease the space between characters.
<html>
<head>
<style type=”text/css”>
h1 {letter-spacing: 3px}
h4 {letter-spacing: 0.6cm}
</style>
</head>
<body>
<h1>This is text 1</h1>
<h4>This is text 2 </h4>
</body>
</html>
How to align the text.
<html>
<head>
<style type=”text/css”>
h1 {text-align: center}
h2 {text-align: left}
h3 {text-align: right}
</style>
</head>
<body>
<h1>This is text 1</h1>
<h2>This is text 2</h2>
<h3>This is text 3</h3>
</body>
</html>