inheritance pf properties to all sub tags

Discussion in 'CSS' started by thinkcenter, Oct 4, 2007.

  1. #1
    HI All,
    I want to know how to make the properties specified in a tag applicable to any tag defined within.
    For ex,
    i have a <p> tag and for that i define the text and other elements. Now for any other elements in between <p> and </p> I want the same properties to be applicable... like i can have a list inside that paragraph, a table, etc...


    also, Is it necessary to mention all types of tags and define properties for that?

    Thanks in advance...
     
    thinkcenter, Oct 4, 2007 IP
  2. codyrockx

    codyrockx Peon

    Messages:
    33
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You'd want to setup your text and any other properties you want to father down as such:
    
    p, p * {
    
    Code (markup):
    That applies the class to the p tag and all descendants. It won't be required of all elements but some defaults are specified by browsers such as the "a" tag and without specifying a trickle down they won't do so on their own.
     
    codyrockx, Oct 4, 2007 IP
  3. soulscratch

    soulscratch Well-Known Member

    Messages:
    964
    Likes Received:
    45
    Best Answers:
    0
    Trophy Points:
    155
    #3
    You'll have really big problems if you use ems or percentages in an element followed by the universal selector.

    body * { font-size:80%; }

    Great example ^. The child will be 80% of the parent, and it will keep getting smaller, smaller, etc.
     
    soulscratch, Oct 4, 2007 IP