CSS - Basic
Ever wondered, how a webpage is beautified? How eye catching visuals, beautiful colors areapplied to a webpage?
Well! It is CSS. CSS is used to design the webpages written in HTML.
Note : We will be learning CSS in detail in the coming tutorials. In this tutorial we will give a brief introduction of what CSS is and how it is useful for us.
What is CSS?
CSS stands for Cascading Style Sheets. It is often used to determine, how HTML elements wouldbe displayed on a webpage. It can also be used to set the colors, fonts in a webpage.
It is CSS which converts an HTML page into a visually stunning webpage using the CSS properties.
Why should we use CSS?
-
You can write CSS once in a CSS file(Which we will be learning later) and use it in multiple HTML pages.
-
CSS lets us set the layout of the HTML page, set colors and give us a visually appealing webpage.
-
Managing and maintaining of HTML pages becomes quite easy with the external CSS file. You can place all the CSS properties in one file(i.e. The external CSS file). And if you change the CSS properties in the external CSS file, the entire layout of the website changes(Since multiple HTML pages are linked to the external CSS file).
Types of CSS
-
External CSS
External CSS is a CSS file with .css extension. We can use this CSS file in the HTML page using the <link ...> element.
<link rel="stylesheet" href="my_style.css">
Where my_style.css is the name of the external CSS file.
-
Internal CSS
Internal CSS is used within the HTML page. The CSS properties are defined within the <style> element inside the HTML page.
<style>
p {
color: red;
}
</style>
-
Inline CSS
Inline CSS is used within the HTML elements using the style attribute.