4 min read · Free · No login needed
CSS (Cascading Style Sheets) is the language that controls how a web page looks: colours, fonts, spacing, layout. HTML builds the structure; CSS paints it. There are three ways to add CSS to a page.
Written in the style attribute of one element: <p style="color: red;">. Quick for testing, but bad for real pages — the same style must be repeated on every element.
Written once inside a <style> element in the <head>. It applies to the whole page. Good for a single page, but every page needs its own copy.
Written in a separate .css file and linked from the page: <link rel="stylesheet" href="styles.css">. One file styles the whole website. Change one line in the CSS file and every page updates at once. This is how every professional website works — including kamaldnp.com.
A CSS rule has a selector and a declaration. The selector says which elements to style; the declaration says how. For example, h1 { color: navy; } makes every h1 navy. .intro { font-size: 18px; } styles every element with class "intro". #header { background: orange; } styles the one element with id "header".
CSS stands for Cascading Style Sheets. It is a separate language that controls how HTML looks — colours, fonts, sizes, spacing, and layout. HTML builds the structure; CSS paints it. One CSS rule can style a hundred elements at once, which is why real websites keep their CSS in one place instead of repeating it.
Here are all three methods in short form. Inline is quickest for one element. Internal is good for one page. External is the professional choice for a whole website.
<!-- 1. Inline: inside the tag -->
<p style="color: red;">Red text.</p>
<!-- 2. Internal: in the head -->
<style>p { color: red; }</style>
<!-- 3. External: a separate file -->
<link rel="stylesheet" href="style.css">
style.css next to your HTML file, link it in the <head>, and keep all your styles in one place. Changing one line then changes the whole site.<link> tag and the file name first.<style> belongs in the <head>..myclass in CSS, class="myclass" in HTML.<style> sits inside the <head> and holds the page's internal CSS, so the rules apply to the whole page without repeating them on every element.h1 { color: navy; } is a rule with the selector h1 — it makes the heading navy blue..intro { color: green; font-size: 18px; } targets only elements with class="intro" — the first paragraph turns green and larger, while the other paragraph is untouched.<p style="color: red;"> is inline CSS, written directly on the tag — it styles just that one paragraph and beats the internal rules.<!DOCTYPE html>
<html>
<head>
<title>CSS</title>
<style>
h1 { color: navy; }
.intro { color: green; font-size: 18px; }
</style>
</head>
<body>
<h1>Styled Heading</h1>
<p class="intro">This paragraph uses a class.</p>
<p style="color: red;">This one uses inline CSS.</p>
</body>
</html>
Change the code below and press Run to see the result instantly. No file to save, no login needed.
The questions learners ask most about this lesson — read the question, then open it to see the answer.
CSS stands for Cascading Style Sheets. It is the language that controls how a web page looks: colours, fonts, spacing, and layout.
Inline CSS in the style attribute, internal CSS in a style element in the head, and external CSS in a separate .css file linked from the page.
One file styles the whole website. Change one line in the CSS file and every page updates at once.
AI can write code for you, but it cannot think for you. When you learn HTML yourself, your brain builds the real skill: you understand why a page looks the way it does, you can fix it when it breaks, and you can answer it in an exam or an interview without help. That is the skill that gets you a job — not a copied answer.
Finish all 35 lessons, pass the test (80%), pay ₹10 and get your certificate.
Take the testPrefer watching? Video courses teach the same topics step by step.
Free tutorials teach you the basics. Our paid courses add live projects, mentorship and a certificate.
Browse all coursesAsk about courses, website & more
Request human callback:
Please log in to download. You will stay on this page after logging in!
New here? Register now →