Menu
×
   ❮     
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS R TYPESCRIPT ANGULAR GIT POSTGRESQL MONGODB ASP AI GO KOTLIN SASS VUE DSA GEN AI SCIPY AWS CYBERSECURITY DATA SCIENCE
     ❯   

W3.CSS Text


Text Alignment

The w3-left-align and the w3-right-align classes are used to align text.

Left aligned text.

Right aligned text.

Example

<div class="w3-container w3-border w3-large">
  <div class="w3-left-align"><p>Left aligned text.</p></div>
  <div class="w3-right-align"><p>Right aligned text.</p></div>
</div>
Try It Yourself »

Centering Elements

The w3-center class is used to center-align elements:

Centered Content

car

Some centered text.

Example

<div class="w3-container w3-center">
  <h2>Centered Content</h2>
  <img src="img_car.jpg" alt="car" style="width:80%;max-width:320px">
  <p>Some centered text.</p>
</div>
Try It Yourself »


Wide Text

The w3-wide class specifies a wider text:

This text is normal.

This text is wider.

Example

<p class="w3-wide">The w3-wide class specifies a wider text.</p>
Try It Yourself »

Text Opacity

The w3-opacity class is designed to work with all colors:

Text Opacity

Text Opacity

Text Opacity

Text Opacity

Example

<div class="w3-panel w3-pink">
  <h2 class="w3-opacity">Text Opacity</h2>
</div>
Try It Yourself »

Text Shadow

The CSS3 text-shadow property can be used to add shadow or blur effects to text:

Text Shadow


Text Shadow


Text Shadow


Text Shadow

Example

<h2 class="w3-blue" style="text-shadow:1px 1px 0 #444">Text Shadow</h2>
Try It Yourself »

Special Effects

Text Opacity + Bold

Yellow Text + Shadow + Bold

Orange Text + Shadow + Bold

Example

<div class="w3-panel w3-pink">
  <h1 class="w3-opacity">
  <b>Text Opacity + Bold</b></h1>
</div>

<div class="w3-panel w3-amber">
  <h1 class="w3-text-yellow" style="text-shadow:1px 1px 0 #444">
  <b>Yellow Text + Shadow + Bold</b></h1>
</div>

<div class="w3-panel w3-blue">
  <h1 class="w3-text-orange" style="text-shadow:1px 1px 0 #444">
  <b>Orange Text + Shadow + Bold</b></h1>
</div>
Try It Yourself »

Text Shadow does not work in IE 9 and earlier.


×

Contact Sales

If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail:
sales@w3schools.com

Report Error

If you want to report an error, or if you want to make a suggestion, send us an e-mail:
help@w3schools.com

W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookie and privacy policy.

Copyright 1999-2024 by Refsnes Data. All Rights Reserved. W3Schools is Powered by W3.CSS.