SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Zealot
    Join Date
    Oct 2002
    Location
    Madison, WI
    Posts
    198
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    CSS inheritance with percents

    I have a table with class DE:

    .DE
    { font-family:Verdana,Arial,Helvetica,sans-serif;
    font-size:75%;
    }


    and I want my form fields to be 85% of default, so inside the table i have:

    <input type="text" class="Regular" name="blat">

    .Regular {
    font-size:85%;
    font-family:Verdana, Arial, Helvetica, sans-serif;
    color: black;
    background:#F9FADF; }

    The problem is my form fields are 85% of 75%, because they are further modifying the DE class. How do I make them simply 85%?

    Please advise, thanks.
    :::::::::::::::::::::::::::::::::::::::::::::::::::
    Versa Studio
    ExpressionEngine experts
    bas (at) versa studio dot com

  2. #2
    morphine for a wooden leg randem's Avatar
    Join Date
    Jun 2002
    Location
    .chicago.il.us
    Posts
    957
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    use {font-size: 110%} instead, no?
    ----Adopt-a-Sig----
    Your message here!

  3. #3
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    maybe.....

    table.DE
    { font-family:Verdana,Arial,Helvetica,sans-serif;
    font-size:75%;
    }

    input.Regular, textarea.Regular, select.Regular {
    font-size:85%;
    font-family:Verdana, Arial, Helvetica, sans-serif;
    color: black;
    background:#F9FADF; }

    If not...then I suppose you could site it back up by using 113%
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev




  4. #4
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Why percentages for font size? Why not em or points? I prefer em.

    --Vinnie

  5. #5
    SitePoint Zealot
    Join Date
    Oct 2002
    Location
    Madison, WI
    Posts
    198
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I use percentages because they allow the user to scale text in IE. I know that percentages can be a problem on some browsers.

    Isn't there a way in style sheet to specify inheritance, something like:

    .DE>.Regular { something something }
    Last edited by 4midori; Oct 22, 2002 at 12:09.
    :::::::::::::::::::::::::::::::::::::::::::::::::::
    Versa Studio
    ExpressionEngine experts
    bas (at) versa studio dot com

  6. #6
    morphine for a wooden leg randem's Avatar
    Join Date
    Jun 2002
    Location
    .chicago.il.us
    Posts
    957
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by 4midori
    I use percentages because they allow the user to scale text in IE. I know that percentages can be a problem on some browsers.
    The em unit of measure also allows scaling, and it's better to use, because your percents are only percentage of the default size, whereas 1em is 1em on all machines.

    Isn't there a way in style sheet to specify inheritance, something like:

    .DE>.Regular { something something }
    In the example you provide, anything with a class="regular" which is a child of something with a class="de" will have the something style.

    Child elements are direct, first-generation descendants. If you want to get all descendants, use a space instead of a greater-than symbol.
    ----Adopt-a-Sig----
    Your message here!

  7. #7
    SitePoint Zealot
    Join Date
    Oct 2002
    Location
    Madison, WI
    Posts
    198
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks, I've considered ems to. I've tried all, but found that % works the best.Is there an FAQ somewhere that compares ems, pts, px and %?
    :::::::::::::::::::::::::::::::::::::::::::::::::::
    Versa Studio
    ExpressionEngine experts
    bas (at) versa studio dot com


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
  •