SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: CSS inheritance

Hybrid View

  1. #1
    WebAmoeba mythix's Avatar
    Join Date
    Aug 2002
    Location
    here
    Posts
    578
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    CSS inheritance

    i'm relativly new to css don't rush me!!!

    I have a style calld tinytxt which is just that tiny text. I also have a style called tinytxtred which is just that tiny text but red.
    Is it possible to make the style tinytxtred 'inherit' the attributes of tinytxt and also change the colour to red?

    Thanks
    Laws are like sausages. You have much more respect for them if you haven't actually seen how they're made.

    http://www.webamoeba.co.uk

  2. #2
    Robert Wellock silver trophybronze trophy xhtmlcoder's Avatar
    Join Date
    Apr 2002
    Location
    A Maze of Twisty Little Passages
    Posts
    6,316
    Mentioned
    60 Post(s)
    Tagged
    0 Thread(s)
    This will probably work:

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
      <head>
    <style type="text/css">
    <!--
    #tinytxt {font-size: 20px }
    #tinytxt .tinytxtred {color: red;}
    -->
    </style>
        <title>Child Inherts SiZe
        </title>
      </head>
      <body>
        <div id="tinytxt">
          This text is 20px
          <div class="tinytxtred">
            This text is 20px but also Red
          </div>
        </div>
      </body>
    </html>
    Last edited by xhtmlcoder; Oct 9, 2002 at 04:46.


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
  •