Both HTML and CSS are the key pillars of modern web development. Let’s learn what’s the main difference between the two.
If you think of a human body, you will find, every one of us has a skeleton structure underneath flesh and skins. The skeleton defines the structure. The flesh and skin create our outlook and appearance. We can use this analogy for a web page too. It’s the HTML that defines the internal structure of the web page, and we use CSS to give it an appealing outlook and feel.
Definition of HTML and CSS
Now, let’s dive a bit deeper into technical jargon.
The term HTML stands for HyperText Markup Language. It’s a standard mark-up language used to display the websites on browser applications. Browsers receive HTML documents (files) from the web server, process and display them on screen. HTML tags and attributes help you display textual content, images, videos, and many more on web pages.
Please bear in mind that HTML builds a web page by defining its structure. But a web page is helpful when users love the appearance and find it easy to use. You’ll need CSS or Cascading Style Sheet to create such a presentation to users. CSS allows you to code to select particular tags of underlying HTML structure and style it as needed.
Example of HTML and CSS
Consider a simple example, and let’s start with a piece of HTML that displays the message “Hello World”.
If you were to save this line into the HTML file and open it in your favorite browser, you’d see the message “Hello World” appear on the screen.
To change the styling, you’ll need to apply the CSS rules. For example, you can change the color of the text to “red”.
<p style="color:red">Hello World</p>
In the above example, we have used the HTML tag
<p> to display a paragraph on a web page. Then we have added the CSS rule with
style = "color:red", to change the appearance of the content.
There’s a lot more to learn about HTML and CSS before you can get to building beautiful modern websites. But for now, let’s remember that HTML lays out the structure and content of the page, and CSS is responsible for styling it.