Basic Text Properties in CSS – Easy Guide for Grade 10 CBSE

Text-related properties in CSS

This section is dedicated to discussing the properties that control the appearance of text on a webpage.

The following properties are to be covered in this section:

  • Text-indent
    • length – e.g. 20px, 2em

    • percentage – e.g. 10% (relative to the containing element’s width)

    • inherit – inherits from parent

  • Text-align
    • left

    • right

    • center

    • justify

    • start (logical left in LTR and right in RTL)

    • end

    • inherit

    •  
  • Text-Decoration
    • none

    • underline

    • overline

    • line-through

    • blink (deprecated in most browsers)

    • inherit

  • Wrod-spacing
    • normal

    • length – e.g. 5px, 0.5em

    • inherit

  • Letter-spacing
    • normal

    • length – e.g. 2px, -1px

    • inherit

  • Text-transform
    • none

    • capitalize – first letter of each word

    • uppercase – all letters uppercase

    • lowercase – all letters lowercase

    • inherit

Example of HTML Program using the above text properties.

<HTML>
<HEAD>
<TITLE> 6.8.2 </TITLE>
<LINK REL=”STYLESHEET” TYPE=”TEXT/CSS” HREF=”SAMPLE5.CSS”>
</HEAD>
<BODY>
<h1> Quote of the day </h1>
<p> It’s never too late to start over. if you weren’t happy with yesterday, try something different today. don’t stay stuck. do better.
<ul>
<li> stay positive </li>
<li> Stay strong </li>
</ul>

</BODY>
</HTML>

CSS file that can be used with the above program to apply different text properties.

h1 {color:red; font-famliy: “time new roman”, serif; font-size: 30px; text-align: centre; text-decoration:underline; text-transform: uppercase;}
p{font-family: arial; font-style: oblique; font-size:1em; text-indent: 30px; word-spacing: 15px; color: Gray;}
li{font-variant: small-caps; color: Blue; text-transform:capitalize; letter-sapcing: 30px; font-family: sans-serif;}

OUTPUT of the program:

Apply Properties related to text using CSS

Instructions to run the program:

  1. Save the above HTML code in Notepad using the file name and .html extension
  2. . Save the sample5.css file in Notepad in the same folder where your HTML file is saved.
  3. See the output in the web browser.

Basic Text Properties in CSS – Easy Guide for Grade 10 Students

This post is useful for text-related properties in CSS for grade 10 CBSE

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top