What is external Style Sheet in css?

Discussion in 'CSS' started by shanmugappriya, Nov 24, 2011.

  1. #1
    What is external Style Sheet in css ?How to connect it?
     
    shanmugappriya, Nov 24, 2011 IP
  2. czent

    czent Peon

    Messages:
    45
    Likes Received:
    2
    Best Answers:
    5
    Trophy Points:
    0
    #2
    External Stylesheet is the CSS file that you link from a HTML page using following line of code:

    <link rel="stylesheet" href="main.css">
     
    czent, Nov 25, 2011 IP
  3. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,999
    Best Answers:
    253
    Trophy Points:
    515
    #3
    Though in MODERN code you should also be using the TYPE and MEDIA attributes -- especially media since what you're sending to screen might not make a lot of sense to print or handheld.

    
    <link
    	type="text/css"
    	rel="stylesheet"
    	href="screen.css"
    	media="screen,projection,tv"
    >
    
    Code (markup):
    The advantages to storing CSS outside the HTML are that you can use the media attribute to target devices by capability so you aren't sending presentation to user agents where it makes no sense, any attributes that are shared across multiple HTML pages are CACHED so you aren't resending the same data over and over again, you can pre-cache the appearance of sub-pages making them appear to load faster for a small penalty on firstload... and in general it keeps the markup cleaner and easier to maintain.

    Which is why IMHO the STYLE tag should be deprecated altogether, and the STYLE attribute should be used only in the handful of cases where the applied style is being used to convey content... which is very, VERY rare. 99% of the time people use <style> or style="" they're doing it all wrong, and failed to grasp the advantages of semantic markup with separation of presentation from content.
     
    deathshadow, Nov 25, 2011 IP
  4. leanocodes

    leanocodes Member

    Messages:
    22
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    26
    #4
    There are 3 ways of declaring a css to your html.

    1. Inline (declared within html)
    2. Import (getting the source which is not editable through)
    3. External (CSS file that is linked externally to your html,mostly used)
     
    leanocodes, Dec 10, 2011 IP
  5. rajmeetbhullar

    rajmeetbhullar Peon

    Messages:
    11
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    linking external style sheet is very easy you have to write this code in the <head>,</head> part
    <link href="" rel="" type="">

    here href stands for hyper refrence i.e name of the style sheet
    rel stands for relation , you have to type style sheet
    type stands for the page upon which you had made style sheet
     
    rajmeetbhullar, Dec 13, 2011 IP
  6. shanmugappriya

    shanmugappriya Peon

    Messages:
    92
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Thanks for your reply guys...
     
    shanmugappriya, Dec 13, 2011 IP
  7. zeeshan146

    zeeshan146 Peon

    Messages:
    65
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    this info is helpful for me also thanks dudes
     
    zeeshan146, Dec 13, 2011 IP
  8. beven

    beven Well-Known Member

    Messages:
    483
    Likes Received:
    1
    Best Answers:
    1
    Trophy Points:
    113
    #8
    through external style sheet u can import styles from other sheet
     
    beven, Dec 20, 2011 IP
  9. devilthemes

    devilthemes Member

    Messages:
    42
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    36
    #9
    ya beven is right
     
    devilthemes, Dec 22, 2011 IP