Results 1 to 5 of 5

Thread: <resolved> CSS inherit

  1. #1

    Thread Starter
    Fanatic Member JPicasso's Avatar
    Join Date
    Aug 2001
    Location
    Kalamazoo, MI
    Posts
    843

    <resolved> CSS inherit

    How do I actually CASCADE these things.

    Or maybe I want to inherit... I'm not sure.

    anyway.

    Say I define a style as
    Code:
    .basictitle {font-size: 16;
    			color: white;
    			font-family: arial;
    			font-weight: bold;
    			border-style: solid;
    			border-width: 1px;
    			background-color: darkblue;
    			}
    Now, what I want to do is use this for my entire website.
    BUT, for some pages I want to modify the font size
    for this element.

    This willl allow me to use a basic style, and then for each
    page I want to put something like :
    Code:
    .advtitle {[somecodehere that references .basictitle];
               font-size:55;}
    so that advtitle will use the bastitle, but be a bit bigger??

    is there a way to do this?
    Last edited by JPicasso; Oct 1st, 2003 at 12:39 PM.
    Merry Christmas

  2. #2

    Thread Starter
    Fanatic Member JPicasso's Avatar
    Join Date
    Aug 2001
    Location
    Kalamazoo, MI
    Posts
    843
    so,

    I can nest styles.

    that is, I can put a

    Code:
    <div class=bastitle>
    <div class=advtitle>
      This will have all of bastitle properties, PLUS overridden properties of advtitle.
    </div>
    </div>


    But what I'd really like to do is have this type of nesting effect take place in the style tag.

    :sigh:
    Last edited by JPicasso; Sep 29th, 2003 at 02:21 PM.
    Merry Christmas

  3. #3
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687
    change
    Code:
    .basictitle {font-size: 16;
    			color: white;
    			font-family: arial;
    			font-weight: bold;
    			border-style: solid;
    			border-width: 1px;
    			background-color: darkblue;
    			}
    to
    Code:
    Body {font-size: 16;
    			color: white;
    			font-family: arial;
    			font-weight: bold;
    			border-style: solid;
    			border-width: 1px;
    			background-color: darkblue;
    			}
    That will se the base for use through out the whole body area (essentially the whole page).... then you can further define other elements as needed.
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  4. #4

    Thread Starter
    Fanatic Member JPicasso's Avatar
    Join Date
    Aug 2001
    Location
    Kalamazoo, MI
    Posts
    843
    I think this is what you were saying, but just for the record.


    Apparently I can define elements, or sub-classes as I like to say, of current HTML tags.

    without explaining, here:

    Code:
    <style type="text/css">
    <!--
    P.beefy {font-family: script;
    		font-size: 40px;
    		}
    P.veggie {font-family: arial;
    			color: green;
    		}
    
    -->
    </style>
    now I can use different sub-classes of the P tag.

    like this:

    Code:
    <body>
    
    <p>
    Hello this is normal <br>
    </p>
    
    <p class=beefy>
    And this is beefy
    This is <b>beefier</b>.
    </p>
    <p>
    Normal again,
    </p>
    
    <p class=veggie>
    This is veggie, hold the bacon
    </p>
    
    </body>
    I love this stuff. Actually makes HTML interesting.
    Merry Christmas

  5. #5
    Frenzied Member
    Join Date
    Nov 1999
    Posts
    1,337
    well you can also do this (I know you resoved it so this is just an FYI)

    if you set a specific font size to the page and want another part to be different.

    body {font-size: 16;
    color: white;
    font-family: arial;
    font-weight: bold;
    border-style: solid;
    border-width: 1px;
    background-color: darkblue;
    }

    then in a P tag you can do this

    <p style="font-weight: normal">

    that should over-write the body style since it is changing a font style.

    that is inheritance

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width