INTRO TO HTML and CSS Tutorial

INTRO TO HTML and CSS

HTML = the bricks, walls, doors, windows, rooms (the structure and content)

CSS = the paint, furniture, curtains, lighting, decoration (the look & feel)

Without HTML → nothing to show. Without CSS → ugly plain page everyone hates.

Let’s start from zero — no previous knowledge needed.

Step 1: What Exactly is HTML?

HTML = HyperText Markup Language It’s not a programming language — it’s a markup language. You use it to “mark up” (label) content so the browser knows what it is.

Example: This is a heading → <h1> This is normal paragraph text → <p> This is a link → <a> This is an image → <img>

Our Very First HTML File (Classic “Hello World” but better)

Create a new file called index.html (use Notepad, VS Code, or any text editor).

Copy-paste this complete code:

HTML

Save it → double-click the file → it opens in your browser!

Now let’s understand every important part:

Part Meaning Required?
<!DOCTYPE html> Tells browser: “This is modern HTML5” Must have
<html lang=”en”> Root element + language (helps screen readers & SEO) Must have
<head> Invisible area — metadata, title, links to CSS/JS Must have
<meta charset=”UTF-8″> Allows special characters (₹, 😊, హాయ్ etc.) Highly recommended
<title> Text shown in browser tab Very important
<body> Everything the user actually sees Must have

Common tags you just used:

  • <h1> to <h6> → headings (h1 = biggest & most important)
  • <p> → paragraph
  • <strong> → bold (importance)
  • <ul> + <li> → unordered list (bullets)
  • <a href=”…”> → hyperlink
  • <img src=”…” alt=”…” width=”…”> → image (alt = very important for accessibility)
  • <blockquote> → quoted text
  • <hr> → horizontal line

Step 2: Let’s Make It Beautiful with CSS

HTML alone is boring — black text on white background.

Create a new file in the same folder called style.css

Put this inside:

CSS

Now connect CSS to HTML. Add one line inside the <head> section of your index.html:

HTML

So your <head> becomes:

HTML

Refresh the browser → Wow! Now it looks professional. 🎉

Quick CSS Basics You Just Learned

Property What it does Common values
color text color red, #ff0000, rgb(255,0,0)
background-color background color white, #f0f0f0
font-family font Arial, “Times New Roman”, system-ui
text-align horizontal alignment left, center, right
margin space outside element 20px, 10px 20px, auto
padding space inside element 15px
border border around element 2px solid black
border-radius rounded corners 10px
:hover style when mouse is over (pseudo-class)

Your Mini Homework (Try Right Now!)

  1. Change the <h1> text to your name
  2. Add one more <li> to the list
  3. Change the background color of body to #fefcbf (light yellow)
  4. Make all <p> text color #4a5568 (cool gray)
  5. Add this after the image:
HTML

Then in CSS add:

CSS

Refresh — you just made your first interactive-looking button!

How did it feel? This is how almost every website starts — simple HTML + CSS.

Next steps (after you finish playing with this):

  • Learn div & class & id
  • Understand CSS box model (margin, border, padding, content)
  • Try making a simple personal card / landing page

Want to go deeper on any part (flexbox, forms, mobile responsive, colors, etc.)? Just tell me — “next lesson” or “explain flexbox like I’m 12” or anything!

Happy coding! 🚀 Your friendly web teacher, Grok