Computer >> Computer tutorials >  >> Programming >> CSS

writing-mode Property in CSS


The writing-mode property is used to set whether lines of text are laid out horizontally or vertically. The property values are −

writing-mode: horizontal-tb|vertical-rl|vertical-lr;

Example

<!DOCTYPE html>
<html>
<head>
<style>
p {
   writing-mode: vertical-rl;
}
</style>
</head>
<body>
<h1>Demo Heading</h1>
<p>This is demo text.</p>
</body>
</html>

Output

writing-mode Property in CSS

Example

Let us now see another example −

<!DOCTYPE html>
<html>
<head>
<style>
p.demo1 {
   word-spacing: 1cm;
   color: blue;
   writing-mode: vertical-rl;
}
p.demo2 {
   word-spacing: 40px;
   writing-mode: horizontal-tb;
}
</style>
</head>
<body>
<h1>Demo Heading</h1>
<h2>Heading2</h2>
<p class="demo1">This is demo text.</p>
<h2>Heading2</h2>
<p class="demo2">This is demo text.</p>
</body>
</html>

Output

writing-mode Property in CSS