In this post, we will understand the difference between HTML and CSS
HTML
It refers to Hyper Text Markup Language.
It helps create web pages and applications.
It helps define structure of web page.
It is a markup language.
It helps create static pages as well.
It helps display data.
HyperText helps define link between multiple web pages.
Markup Language helps define text document using tags, which gives a structure to the web page.
It has less backup and support options.
HTML can’t be used inside a CSS sheet.
It helps annotate the text so that a system can understand it and use it.
There are specific number of tags in HTML.
These tags are predefined.
Data is enclosed within tags.
Closing tags are not a necessity.
An example of HTML −
Example
<!DOCTYPE html> <html> <head> <title>My title</title> </head> <body> <h1>title</h1> <p>A sample</p> </body> </html>
Output
CSS
It helps style the web pages.
It uses different styling features to achieve the same.
It uses ‘selectors’ and ‘declaration blocks’.
It can be an external file or an internal file, depending on the requirement in hand.
CSS can be used inside a HTML document.
It can be used to display data.
It has a higher backup and support in comparison to HTML.
An example of CSS −
Example
<style> p { color: pink; text-align: left; } </style>