HTML vs. CSS

Difference Between HTML and CSS

HTML

HTML (Hyper Text Markup Language), 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 web pages.  A markup language is a set of mark up tags and HTML uses markup tags or HTML tags, to 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 analyze 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. HTML can be also used to create interactive forms.

CSS

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.  Originally, HTML was not meant to have tags for formatting a document. It was only meant to define the content. But, with the introduction of tags like <font> in HTML 3.2 web developing became very difficult as, adding font and color information when developing large web sites ,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 allows the creation of 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.

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.