Cascading Style Sheets
Essay by nikkirw82 • January 20, 2013 • Essay • 433 Words (2 Pages) • 1,623 Views
Cascading Style Sheets, also referred to as, CSS are created so developers are able to separate the design from the content. This process allows HTML to do the markup of the content and the developer does not have to worry about the layout. CSS are separated into one of three different categories, which are as follows: external, embedded, and inline CSS. Each type of CSS has pros and cons, it really depends upon the situation.
Inline CSS are applied in the middle of the HTML code and only apply to whichever line it is inserted into. Inline CSS also has the highest priority which means it will override any other CSS that is already in place for that individual line. Since developers do not have to worry about creating a new document or edit CSS in the head of the document, it makes Inline CSS quick and easy to use. However, the ease of Inline CSS can also be considered a disadvantage. If using this CSS, every single line of code will have to be edited. Inline CSS cannot perform complex styles like the visited, active, or link color of an anchor tag.
Embedded CSS are placed at the head of the document and will only affect the page that the style is placed on. Embedded CSS can have a higher priority than External CSS if they are placed after the link to the external style. Just as Inline CSS there are no external files to load as the style is placed directly on the page affected. There are two large disadvantages of Embedded CSS. One is that Embedded CSS can only affect the page the style is placed upon. The second is the increased load time because the style has to be loaded and parsed for every page viewed.
The third type of CSS is External CSS. This is the most preferred method because it keeps the CSS separate from the HTML by placing the CSS in a separate file. This enables the developer to change the look of several pages without coding each page; one would only have to provide the page with a "link" tag. However, External CSS can become very large in a short amount of time because the style is never removed even if the page is. These large style sheets can cause slow upload times because the entire style sheet has to be loaded before the page is displayed.
References
Bojack, H. (2008). New perspectives on blended HTML, XHTML, and CSS: Introductory. Boston: Course Technology. Retrieved: April 6, 2011
...
...