Difference between HTML and CSS

  • HTML
    HTML stands for Hyper Text Markup Language and it is the language which is used to define the structure of a web page. HTML is used along with CSS and Java script to design web pages. HTML is the basic building block of a website. It has different attributes and elements with different properties.Each element has a opening and a closing tag. We can also add images by the help of HTML.

    Example:

    filter_none

    edit
    close

    play_arrow

    link
    brightness_4
    code

    <html>
    <body>
        <h1>Welcome to GeeksForGeeks</h1>
    </body>
    </html>

    chevron_right

    
    

    Output:

  • CSS:
    CSS stands for Cascading Style Sheets and it is used to style web documents. It is used to provide the background color and is also used for styling. It can also be used to style the font and change its size. We can also style many different web pages with the same specifications by the help of CSS. CSS is also recommended by World Wide Web Consortium (W3C). It can also be used along with HTML and Java script to design web pages.
    Example:

    filter_none

    edit
    close

    play_arrow

    link
    brightness_4
    code

    <html>
    <head>
    <style>
    body {
      background-color:red;
    }
    </style>
    </head>
    <body>
      
    <h1>Welcome to GeeksForGeeks!</h1>
      
    <p>This page has red background color</p>
      
    </body>
    </html>

    chevron_right

    
    

    Output:

Difference between HTML and CSS:

S.NO. HTML CSS
1. HTML is used to define a structure of a web page. CSS is used to style the web pages by using different styling features.
2. It consists of tags inside which text is enclosed. It consists of selectors and declaration blocks.
3. HTML doesn’t have further types. CSS can be internal or external depending upon the requirement.
4. We cannot use HTML inside a CSS sheet. We can use CSS inside a HTML document.
5. HTML is not used for presentation and visualization. CSS is used for presentation and visualization.
6. HTML has comparatively less backup and support. CSS has comparatively higher backup and support.

full-stack-img




My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.