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 667327
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T23:54:57+00:00 2026-05-13T23:54:57+00:00

I was going through Nicholas Zakas presentation on JavaScript here : http://www.slideshare.net/nzakas/writing-efficient-javascript (slide number:

  • 0

I was going through Nicholas Zakas presentation on JavaScript here : http://www.slideshare.net/nzakas/writing-efficient-javascript (slide number: 89/139)

He recommends using cssText property whenever you are setting a bunch of styles through JavaScript. The best solution is obviously adding those styles to a class and then using JS to add the classname to an element.However, in many situations, We resort to just setting the properties directly within JS when the number of properties are low.

It seems from his presentation that using cssText property would be more efficient in such scenarios.I tried to look up more on the property but couldn’t find much information.

Has anyone used the ‘cssText’ property ? It would be great to have some more technical info on how the property helps.

  • 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-13T23:54:58+00:00Added an answer on May 13, 2026 at 11:54 pm

    It’s a string representation of the inline styles set on an element.

    <head>
    <style type="text/css">
     .foo {color: #d0d;}
    </style>
    </head>
    <body>
     <p id="e0" class="foo" style="border:2px solid #654;">foo</p>
    </body>
    

    console.log(document.getElementById('e0')); gives “border: 2px solid rgb(102, 85, 68);” in my setup (which in the inline style and not anything from the class).

    If you are setting many styles on an element, it is good to set them in one go as a string (using this property) to avoid triggering the reflows that can happen when setting certain style properties.

    Links:
    msdn take on cssText
    phpied.com reflow discussion

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

Sidebar

Related Questions

Going through the Game Center / GameKit docs, I could not find any information
While going through MSDN I found that in button properties useSubmitBeheviour there is written
While going through the checkBox I found there is written CheckBox checkbox = (CheckBox)sender
After going through couple of linksI came to know that Perl does the compilation
After going through a lot of articles on IDisposable , I got confused about
I'm going through the w3cschools XSLT tutorial, and I am at this page: xsl-if
I have been going through the docs and source code looking for something without
I'm going through the full tutorial at cplusplus.com, coding and compiling each example manually.
I was going through someone's code where I came across a thread: while(TRUE) {
I started going through The Definitive Guide to Django and now would like to

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.