Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 738931
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T08:20:32+00:00 2026-05-14T08:20:32+00:00

Douglas Crockford describes the consequence of JavaScript inquiring a node’s style. How simply asking

  • 0

Douglas Crockford describes the consequence of JavaScript inquiring a node’s style. How simply asking for the margin of a div causes the browser to ‘reflow’ the div in the browser’s rendering engine four times.

So that made me wonder, during the initial rendering of a page (or in Crockford’s jargon a “web scroll”) is it faster to write CSS that defines only the non-zero/non-default values? To provide an example:

div{  
  margin-left:2px;  
}

Than

div{  
  margin:0 0 0 2px;  
}

I know consequence of this ‘savings’ is insignificant, but I think it is still important to understand how the technologies are implemented. Also, this is not a question about formatting CSS–this is a question about the implementations of browsers rendering CSS.

Reference: http://developer.yahoo.com/yui/theater/video.php?v=crockonjs-4

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T08:20:33+00:00Added an answer on May 14, 2026 at 8:20 am

    No, depending on your browser, it will unpack the values in different ways before even applying the styles, and in Firefox, it would have a slight effect on the execution speed. It’s a good idea to use shorthand CSS either way though.

    If you want to understand how it works, Firefox, unpacks the value:

    {margin: 0 0 0 2px;}
    

    as

    {margin-top: 0pt;margin-right: 0pt;margin-bottom: 0pt;margin-left: .04pt;}
    

    before applying the styles to the page. This is for normalization.

    *(.04pt is an estimation)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Douglas Crockford says: JavaScript is a sloppy language, but inside it there is an
In Douglas Crockford's JavaScript: The Good Parts he recommends that we use functional inheritance.
I remember reading in Douglas Crockford's Javascript the Good Parts book that there is
I was reading Douglas Crockford's web page, JavaScript: The World's Most Misunderstood Programming Language
I read here (Douglas Crockford) using prototype operator to add methods to Javascript classes
Douglas Crockford himself says so ! http://www.crockford.com/javascript/javascript.html I have been working with JS only
So I finished watching Douglas Crockford's excellent series on Javascript, and in the final
In Coders at work , Douglas Crockford discusses how bugs in browsers cause Javascript
It's not the setup to a joke, i'm really asking. Douglas Crockford is fond
I've been reading Douglas Crockford's JavaScript: The Good Parts , and I came across

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.