Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5

Thread: CSS Variables?

  1. #1
    Regular Coder student101's Avatar
    Join Date
    Nov 2007
    Posts
    634
    Thanks
    80
    Thanked 15 Times in 15 Posts

    Question CSS Variables?

    Is it possible to do variables in CSS that will automatically find and work with the different divs?
    Example;
    Code:
     
    #corner1,#corner2,#corner3,#corner4,#corner5 {
     width:650px;
     padding:0px;
     border: 1px solid #999999;
     margin-right: auto;
     margin-left: auto;
     margin-top: 50px;
    }
    #corner"all numbers" p {
     padding: 5px;
    }
    Standard method;
    Example;
    Code:
     
    p {
     padding: 5px;
    }
    #corner1,#corner2,#corner3,#corner4,#corner5 {
     width:650px;
     padding:0px;
     border: 1px solid #999999;
     margin-right: auto;
     margin-left: auto;
     margin-top: 50px;
    }
    Thanks for your support!
    Update MySQL with checkboxes | Tell A Friend | Delete MySQL with checkboxes

    Give thanks & resolve when done :thumbsup:

  • #2
    Senior Coder effpeetee's Avatar
    Join Date
    Feb 2007
    Location
    Clapham Junction - London SW
    Posts
    4,885
    Thanks
    228
    Thanked 204 Times in 203 Posts
    I asked this question once here. The answer was No! Not if you mean a variable that can have a value assigned to it to be used in a calculation.

    This is OK. Assigning the same css to more that one Div name. That is OK.

    Code:
    #corner1,#corner2,#corner3,#corner4,#corner5 {
     width:650px;
     padding:0px;
     border: 1px solid #999999;
     margin-right: auto;
     margin-left: auto;
     margin-top: 50px;
    }
    This second part is not valid.

    Code:
    #corner"all numbers" p {
     padding: 5px;
    }




    Frank
    Last edited by effpeetee; 10-31-2009 at 12:42 PM.
    * Sources (updated: 21.11.2012.
    Using Windows 8 Professional. 64bit with HP Photosmart 5510 printer Very useful site here.

  • #3
    Regular Coder student101's Avatar
    Join Date
    Nov 2007
    Posts
    634
    Thanks
    80
    Thanked 15 Times in 15 Posts
    I've seen some neat CSS tricks on quirks mode.
    Ok cool no vars in CSS.
    Thanks for your support!
    Update MySQL with checkboxes | Tell A Friend | Delete MySQL with checkboxes

    Give thanks & resolve when done :thumbsup:

  • #4
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,801
    Thanks
    160
    Thanked 2,216 Times in 2,203 Posts
    Blog Entries
    1
    Can't you just wrap them inside a container and use a specific selector, say
    Code:
    #myelements div{
    /* all style goes here */
    }
    Code:
    <div id="myelements">
     <div>1</div>
     <div>2</div>
     <div>3</div>
    </div>
    Or set a class on all divs and use an appropriate selector.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #5
    Regular Coder student101's Avatar
    Join Date
    Nov 2007
    Posts
    634
    Thanks
    80
    Thanked 15 Times in 15 Posts
    that could work, just wanted to find out about variables and if possible.
    Thanks.
    Thanks for your support!
    Update MySQL with checkboxes | Tell A Friend | Delete MySQL with checkboxes

    Give thanks & resolve when done :thumbsup:


  •  

    Posting Permissions

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