HTML is just a structure of a website, like a physical body and CSS are like accessories that we wear to look good. In the same way, CSS makes the plain HTML website look stylish and more colorful.
CSS stands for Cascading Style Sheet. It specifies how HTML elements will appear on a
screen, in print, or in other media. CSS helps us save time and effort due to its ability to
control the layout/style of different web pages at once.
Advantages of CSS:
· Improves Website Speed
· Better Device Compatibility
· Makes code easy to maintain
3 ways you can add CSS to your page:
· Inline CSS
Inline CSS is implemented by adding the style attributes in the relevant tag.
<h2 style=" colour:red;">Inline CSS </h2>
· Internal CSS
The internal style sheet is used to add a unique style for a single document. It is defined in <head> section of the HTML page inside the <style> tag.
<style>
h1 {
color: red;
margin-left: 80px;
}
</style>
· External CSS
When you wish to make style to numerous pages, you should use the external style sheet. It is great for this situation because it allows you to modify the appearance of the complete website by changing only one file.
It uses the <link> tag on every page and the <link> tag should be put inside the head section.
<head>
<link rel="stylesheet" type="text/css" href="mystyle.css">
</head>
Comentarios