Friday, August 15, 2008

Internal Style Sheets - the <style> tag

Internal style sheets are contained within the HTML document itself. The CSS rules are contained within the <style> element. The <style> element is itself contained in the <head> element.
Example:
<style type="text/css">
p
{
font-size: 1.6em;
}
</style>

This kind of style sheet is also called embedded style sheet or document style sheet.

Disadvantages of Internal Style Sheets

  • The style sheet code has to be repeated in every page of a web site - which is a hassle and adds to the size of every web page
  • Modification of the CSS is tedious because every page of the web site will have to be updated

Advantages of Internal Style Sheets

  • The browser does not have to download a separate file containing the style sheet - this reduces latency when rendering the web page

No comments: