Results 1 to 2 of 2

Thread: Javascript Style vs. CSS Style (Best Practice)

  1. #1
    Sencha User voodoov's Avatar
    Join Date
    Mar 2012
    Posts
    34
    Answers
    1
    Vote Rating
    0
      0  

    Default Unanswered: Javascript Style vs. CSS Style (Best Practice)

    Hi,

    In large applications, is it better to write custom css in JS file or CSS file?
    Which one has better performance?

    Javascript Style:
    Code:
    {
      xtype: 'label',
      html: 'Some Text',
      style: {
        fontWeight: 'bold',
        display: 'block',
        float: 'left',
        margin: '2'
      }
    }
    or

    CSS Style:
    Code:
    {
       xtype: 'label',
       html: 'Some Text',
       cls: 'myStyle'
    }
    -------------------
    .myStyle {
      font-weight: bold;
      display: block;
      float: left;
      margin: 2px;
     }
    Thank you in advance.

  2. #2
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,790
    Answers
    583
    Vote Rating
    390
      0  

    Default

    I doubt there's a measurable performance difference. Where possible I would favour the separate CSS file approach.

Posting Permissions

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