User can arrange the text in a required positions either Left or Right or Center by using the
w3-left-align and
w3-right-align and
w3-center. The code below demonstrates the aligning the text at right side or left side.
[html]
<!DOCTYPE html>
<html>
<title>W3.CSS</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://www.w3schools.com/lib/w3.css">
<body>
<div class="w3-container">
<h2>Text Alignments</h2>
<div class="w3-container w3-border w3-large">
<div class="w3-left-align"><p>SPLESSONS-Left.</p></div>
<div class="w3-right-align"><p>SPLESSONS-Right.</p></div>
</div>
</div>
</body>
</html>
[/html]
Result
By running the above code in a preferred browser user can get the following output as shown in below image.
The code below demonstrates the align the text at center as shown below.
[html]
<!DOCTYPE html>
<html>
<title>W3.CSS</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://www.w3schools.com/lib/w3.css">
<body>
<div class="w3-container w3-center">
<h2>Centered Content</h2>
<img src="splesson.png" alt="splessons" style="width:80%;max-width:320px">
<p>The w3-center class centers an element.</p>
</div>
</body>
</html>
[/html]
Result
By running the above code in a preferred browser user can get the following output as shown in below image.
Wide and Slim Classes
W3.CSS also display the wide and slim classes by which it can display the text in a wide type and slim type. The code below demonstrates the Wide and slim classes as shown below.
[html]
<!DOCTYPE html>
<html>
<title>W3.CSS</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://www.w3schools.com/lib/w3.css">
<body>
<div class="w3-container">
<h2>Wide and Slim Classes</h2>
<p class="w3-wide">Simple Programming Lessons Tutorials.</p>
<p class="w3-slim">Simple Programming Lessons Tutorials.</p>
<p>Normal text.</p>
</div>
</body>
</html>
[/html]
Result
By running the above code in a preferred browser user can get the following output as shown in below image.