The Lodge is members-only design/dev videos and Office Hours.

Next Office Hours Session: "Implementing an SVG Icon System" Nov 30 - 6:00 PM Eastern

width:expression(document.body.clientWidth < 782? "780px" ?

  • # October 6, 2008 at 6:28 am

    Hey I just downloaded the perfect width template from this site and I found in the css for the #pagewrap div

    width:expression(document.body.clientWidth < 782? "780px" : document.body.clientWidth > 1262? "1260px" : "auto");

    I have never come across anything like in css what does it mean?

    Thanks for your help?


    # October 6, 2008 at 7:41 am

    It’s called a CSS expression. Google can give you a better explanation, but in short it’s a way to assign the result of a Javascript expression to a CSS attribute, rather than a static value.

    EDIT: if you need a literal explanation of the code itself, it is stating:

    if the body width is less than 782
    then set the width to 780
    else if the body width is greater than 1262
    then set the width to 1260

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

There's a whole bunch of content on CSS-Tricks.

Search for Stuff   •   Browse the Archives

Get the Newsletter ... or get the RSS feed