Style Sheets
  Home arrow Style Sheets arrow Page 5 - CSS: Working with Text
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
STYLE SHEETS

CSS: Working with Text
By: James Payne
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 2
    2008-03-10

    Table of Contents:
  • CSS: Working with Text
  • How to Set the Background Color of Text or Highlight the Text
  • You Seem So Distant
  • How To Align Your Text
  • Indenting Text

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    CSS: Working with Text - Indenting Text


    (Page 5 of 5 )

    You can indent text using text-indent:

    <html>

    <head>

    <style type="text/css">

    p {text-indent: 1cm}

    h1 {text-indent: 10%}

    h2 {text-indent: 20%}

    h3 {text-indent: 30%}

    h4 {text-indent: 40%}

    h5 {text-indent: 50%}

    h6 {text-indent: 60%}

    </style>

    </head>

    <body>

    <p>

    Chuck Norris stared deeply into the darkness, unaware that it stared deeply back at him. A rustle, ever so faint, finger brushing against leaf. But it was enough...

    </p>

    <p>He ran blindly towards the sound, the wind whipping through his powerful goat-tee, giving brief glimpses to the first that lay hidden beneath</p>

    <h1>Bruce Lee</h1>

    <h2>Gary Coleman</h2>

    <h3>Chuck Norris</h3>

    <h4>In a film by James Payne</h4>

    <h5>A James Payne Joint</h5>

    <h6>Coming this Fall to a theatre near you...</h6>

    <h3><i>Midget Blood Bath 4000</i></h3>

    </body>

    </html>

    As you can see, you can set the indentation by centimeters or percentage.

    Transforming Text

    You can transform your text using text-transform. This allows you to set your text in all lowercase or uppercase, and lets you choose to capitalize the first letter of each word:

    <html>

    <head>

    <style type="text/css">

    p.uppercase {text-transform: lowercase}

    p.lowercase {text-transform: uppercase}

    p.capitalize {text-transform: capitalize}

    b {text-transform: uppercase}

    </style>

    </head>

    <body>

    <p class="uppercase">Cookie Crisp is a good idea, but it fails in its execution</p>

    <p class="lowercase">I Love Apples Jacks</p>

    <p class="capitalize">fruit loops are good too</p>

    </body>

    <p><b>you mental midget</b></p>

    </html>

    This results in the following:

      cookie crisp is a good idea, but it fails in its execution

      I LOVE APPLE JACKS

      Fruit Loops Are Good Too

      YOU MENTAL MIDGET

    Conclusion

    Well that's it for this tutorial. We covered a lot of ground, but there are still a few ways to manipulate text in CSS. In our next episode we will discuss these, as well as manipulating fonts, and probably cover how to work with tables in CSS as well. So come back often, send me lots of money, and get to learning.

    Till then...


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

       · Thanks for stopping by to read my article on CSS Text. In this episode we discuss...
     

    STYLE SHEETS ARTICLES

    - Using a Background Grid to Assist Web Page L...
    - Extending the Rule Of Thirds for Web Page La...
    - A Two-Column Web Page Layout Based on the Ru...
    - Using the Rule Of Thirds for Web Page Layout
    - Swapping Columns Using the Divine Ratio for ...
    - Using the Golden Ratio in Liquid Web Page De...
    - Fundamental Design Principles for Web Page L...
    - Pulling Web Page Elements with the Blueprint...
    - Pushing Web Page Columns with the Blueprint ...
    - Controlling Column Padding with the Blueprin...
    - Prepending Classes in the Blueprint CSS Fram...
    - Appending Grid Units with the Blueprint CSS ...
    - Changing Grid Units in the Blueprint CSS Fra...
    - The Blueprint CSS Framework
    - Building a Liquid Design with Evened Margins...







    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 5 Hosted by Hostway
    Stay green...Green IT