Inline And External Together?

Discussion in 'CSS' started by gobbly2100, Jun 22, 2007.

  1. #1
    Am I able to use inline and external stylesheets together?
     
    gobbly2100, Jun 22, 2007 IP
  2. krt

    krt Well-Known Member

    Messages:
    829
    Likes Received:
    38
    Best Answers:
    0
    Trophy Points:
    120
    #2
    Yes. In fact, there is even @import to use in your <style> tag. Using <link /> for external CSS with internal CSS is fine too.
     
    krt, Jun 22, 2007 IP
  3. Dan Schulz

    Dan Schulz Peon

    Messages:
    6,032
    Likes Received:
    436
    Best Answers:
    0
    Trophy Points:
    0
    #3
    When using LINK, make sure that the syntax matches the DOCTYPE you are using. If you're using HTML, it should be <link> - for XHTML (even if served as HTML) it should be <link /> (as krt had demonstrated).

    Just beware of the "Cascade"-ing part of "Cascading Style Sheets" when mixing styles though. Inline styles (those in the HTML file) will always trump external files (those served in a separate file), unless you use !important (and even then, some browsers may ignore it anyway). If you have a linked stylesheet and an embedded stylesheet, whichever one comes LAST will over-ride the earlier stylesheet if any of the rules in both match up (for example, if you link to a stylesheet that says all paragraphs must have red text and a white background, and then have an embedded stylesheet that says all paragraphs must have blue text on a green background, then all the paragraphs will have blue text on green backgrounds).
     
    Dan Schulz, Jun 22, 2007 IP