Results 1 to 5 of 5

Thread: How to Change CSS Text Color

  1. #1
    Join Date
    Feb 2009
    Posts
    80

    How to Change CSS Text Color

    hello
    I use this code to set my background-color and my scrollbar color, but whatever I try, I can't seem to change my text-color. Can someone tell me how to edit that color ?

  2. #2
    Join Date
    Aug 2007
    Posts
    1,098

    Re: How to Change CSS Text Color

    try to use Css to change text color (not using it for headers)
    .navy {color:#000080;}
    .black {color:#00000;}
    etc
    HTML= <div class="navy"> etc

  3. #3
    Join Date
    Jan 2008
    Posts
    1,521

    Re: How to Change CSS Text Color

    1. Open up your text-based HTML editor. Open up a file so you can see and edit the source.
    2. Set up default colors. Create a tag: <style type="text/css"> and insert it before the body tags. After that, begin defining the colors of different types of text. For example, to make all the headlines blue, type: H1 {color: blue}. Define all the text types, each one on a separate line. When you are done, close the tag with </style>.
    3. Use default colors. After defining default colors, whenever you use that particular tag, it will be in your predefined color. For example, we have set H1 to blue, so if you were to type <h1> WOW! </h1> it would automatically be in blue.
    4. Make an exception. If you want something to be something other than the default color, then simply place the CSS tag within the HTML tag to change it on the fly. For example, to change headlines to red, you would type <h1 style="color: red"> Now it's Red!</h1>.
    5. Use contextual selectors. When defining defaults in the beginning, you can also set up more exceptions, based on context. For example, if you want all italics in the headline to be green, you would type: <h1 i "color: green">. Now, whenever you make something italic within a headline, it will be green, but outside it will be the default color.

  4. #4
    Join Date
    Feb 2008
    Posts
    1,852

    Re: How to Change CSS Text Color

    try this

    <html>

    <head>
    <style type="text/css">
    h1 {color: #00ff00}
    h2 {color: #dda0dd}
    p {color: rgb(0,0,255)}
    </style>
    </head>

    <body>
    <h1>This is header 1</h1>
    <h2>This is header 2</h2>
    <p>This is a paragraph</p>
    </body>

    </html

  5. #5
    Join Date
    Oct 2005
    Posts
    2,393

    Re: How to Change CSS Text Color

    if you wish to set the text color for the whole page, then use this code....
    Code:

    <style type="text/css">
    <!--
    body {
    color:#ff0000;
    }
    //-->
    </style>
    ....if you wish to set the text color for a specific element, then use this code....
    Code:

    <style type="text/css">
    <!--
    .foo {
    color:#ff0000;
    }
    //-->
    </style>

    ...then add this to the element...
    Code:


    <div class="foo">this text will be red</div>

Similar Threads

  1. How to change title text color on Windows 8
    By Jason Voorhees in forum Customize Desktop
    Replies: 4
    Last Post: 24-09-2012, 03:45 PM
  2. How to change cell color in excel based on text input
    By Chini mao in forum Windows Software
    Replies: 2
    Last Post: 06-01-2012, 09:19 PM
  3. Procedure to Change font text color in Windows 7
    By chyarte in forum Windows Software
    Replies: 4
    Last Post: 03-12-2010, 06:45 AM
  4. How to change text color using 'IF" in Excel
    By Antrix in forum Windows Software
    Replies: 2
    Last Post: 26-06-2009, 07:02 PM
  5. Change text color in Console
    By Zool in forum Software Development
    Replies: 4
    Last Post: 08-05-2009, 11:19 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,038,073.76274 seconds with 16 queries