1. #1
    Sencha User voodoov's Avatar
    Join Date
    Mar 2012
    Posts
    34
    Vote Rating
    0
    Answers
    1
    voodoov is on a distinguished road

      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,773
    Vote Rating
    372
    Answers
    578
    skirtle has a reputation beyond repute skirtle has a reputation beyond repute skirtle has a reputation beyond repute skirtle has a reputation beyond repute skirtle has a reputation beyond repute skirtle has a reputation beyond repute skirtle has a reputation beyond repute skirtle has a reputation beyond repute skirtle has a reputation beyond repute skirtle has a reputation beyond repute skirtle has a reputation beyond repute

      0  

    Default

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

Thread Participants: 1