HOME | PHP Tutorial | CSS
facebook icon
PHP Tutorial

PHP forms
HTML Tutorial

CSS Tutorial

CSS text-align property

CSS Tutorial » CSS text-align

The text-align property is used to specify the horizontal alignment of inline-level content such as text and images.
left - The default value.
right - Content aligns to the right side.
center - Content centers between the left and right edges.
justify - Content spaces out such that as many blocks fit onto one line as possible and the first word on that line is along the left edge and the last word is along the right edge.
inherit - The value will be whatever the parent element's is.

We can add CSS text-align as:
Inline - by using the style attribute in HTML elements
Internal - by using a <style> element in the <head> section
External - by using an external CSS file as style.css


Syntax: Internal & External CSS.
text-align: left or right or center or justify or initial or inherit;;

Note: use external CSS instead.

How to create CSS text align - examples

You can try to execute the following code to change CSS Text Align of a text on this page.

Example 1, How to create CSS Text Align - examples:

  <!DOCTYPE html>
<title>How to create CSS Text align - examples - example</title>
h1 {
text-align: center;;
p {
text-align: right;
span {
text-align: justify;
.text-al {
text-align: right;
<h1>Text Align Property for h1 center</h1>
<p>How to create CSS text-align Property for paragraph right</p><br />
<span>How to create CSS text-align Property for paragraph justify</span><br />
<div style="text-align:right; color:#33CC33">Ccreate CSS Text Align Property inline to right </div><br />
<div class="text-al">Ccreate CSS Text Align Property for div</div><br />
Note: Use external CSS instead.

css text-align, css text align vertical, css align center, vertical align middle, vertical align center, align content in div, vertical align text in div, how to place something in the middle css, float center css CSS text-align - css tutorial

2704. CSS Layers - CSS tutorial
EchoEcho.Com : The complete CSS tutorial

2705. CSS Levels - CSS tutorial
EchoEcho.Com : The complete CSS tutorial

2703. Introduction - CSS tutorial
EchoEcho.Com : The complete CSS tutorial

2702. CSS Cursors - CSS tutorial
EchoEcho.Com : The complete CSS tutorial

2706. CSS Links - CSS tutorial
EchoEcho.Com : The complete CSS tutorial

2225. CSS Tutorial - Background
Once you specified you want no-repeat for your background image, the browser default behavior is to top-left align the image. And this takes us to the next background property

Your add here
PHP strtoupper() function

PHP define() function

PHP printf() function

PHP strtolower() function

PHP str_replace() function

PHP html_entity_decode() function

PHP ltrim() function

PHP print() function

PHP ucfirst() function

PHP strcmp() function

PHP strstr() function

PHP str_split() function

PHP rtrim() function

PHP empty() Function

PHP strrchr() Function

PHP similar_text() function

CSS font color
HTML Table Style
CSS Text Style - Text Font Size - Text Align
CSS background image size to fit full screen
CSS Border Width
SQL delete row - SQL delete table