CSS: Is it ok to put multiple Browser syntax into one file?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Samishii23
    New Member
    • Sep 2009
    • 246

    CSS: Is it ok to put multiple Browser syntax into one file?

    Would my CSS file have issues if I put syntax for Firefox, Chrome, and IE all into the same file? Or dynamically print out the appropriate syntax based on the browser?
  • drhowarddrfine
    Recognized Expert Expert
    • Sep 2006
    • 7434

    #2
    If you mean "vendor extensions" like -moz then, yes, you can insert as many as you like.

    Comment

    • Samishii23
      New Member
      • Sep 2009
      • 246

      #3
      Well since Mozilla and WebKit are really the only "Browsers" out, since IE, as it is basicly the most used browser out there and the least featured... like doing this:
      Code:
      filter: progid: DXImageTransform.Microsoft.gradient( startColorstr=#FFFFFFFF, endColorstr=#FF339900 );
      background: -moz-linear-gradient( 0% 100% 90deg, #fff, #390 );
      background: -webkit-gradient( linear, 0% 0%, 0% 100%, from(#fff), to(#390) );
      All in the same file. Wouldn't that cause a couple of warning errors in the browser that don't support like "filter" or do they just drop em and move on, and it doesn't really effect performance, or display at all?

      Comment

      • Markus Igeland
        New Member
        • Feb 2011
        • 14

        #4
        There is no problem inserting whatever you'd like into CSS, as the CSS-parsers only fail if a declaration isn't well-formed. This is CSS that neither make a CSs-parser crash, nor style the element:
        Code:
        element { give-color-to-background: red and blue; }

        Comment

        • JKing
          Recognized Expert Top Contributor
          • Jun 2007
          • 1206

          #5
          It will produce a warning but it should skip to the next declaration.

          If you were to make separate stylesheets for each browser that would be an additional call to the server for each stylesheet.

          It is perfectly safe to put them all in one.

          Comment

          Working...