Difference Between HTML and CSS

HyperText Markup Language, widely known as HTML is the leading markup language for web pages. HTML is the basic building block of web pages. Web browser reads the HTML document and composes them into visual or audible web pages. Cascading Style Sheets (CSS) is a language that describes the look and formatting of a document written using a mark up language. CSS is widely used to style web pages written in HTML.

What is HTML?

HTML, as mentioned earlier is a markup language, not a programming language. A markup language is a set of mark up tags and HTML uses markup tags, which are usually called HTML tags, to describe web pages. HTML documents describe web pages and they contain HTML tags and plain text. HTML tags could be identified easily in a HTML document since they are surrounded by angle brackets (e.g. <HTML>). HTML tags are typically inserted in to a document in pairs, where the first tag is the start tag (e.g. <b>) and the second tag is the end tag (e.g. </b>). The task of a web browser (e.g. Internet Explorer, Firefox, etc.) is to read a HTML document and display it as a web page. The browser uses the HTML tags to interpret the content of the page and the HTML tags themselves are not displayed by the browser. HTML pages can embed images, objects and scripts written in languages like JavaScript. Further, HTML can be used to create interactive forms.

What is CSS?

As mentioned earlier, CSS defines how HTML elements need to be displayed in a page. Originally, HTML was not intended to have tags for formatting a document, but to define the content. But, the introduction of tags like <font> in HTML 3.2 made the lives of web developers very difficult. When developing large web sites, adding font and color information to every page became a very tedious process. As a solution to this problem, World Wide Web Consortium (W3C) created CSS. HTML 4.0 allows all formatting to be removed from the HTML document and to be stored in a separate CSS file. CSS enables separation of document content from document presentation such as layout, colors and fonts. This would allow multiple web pages to share the same formatting and reduce complexity and repetition in structural content. CSS can also allow the same markup page to be presented in different styles by allowing the readers to choose a different style sheet to override the one specified by the author of the web page. Today CSS is widely used and supported by all the browsers.

Difference Between HTML and CSS

The main difference between HTML and CSS is that HTML is a markup language that is used to specify the content of a web page, while CSS is a style sheet language that is used to specify the formatting of web page. Even though HTML can also specify formatting of a web page, using CSS for this purpose would be more effective, since it would allow separation of content from presentation and Site-wide consistency.