HTML & CSS: The Building Blocks of the Web
HTML (HyperText Markup Language)
What it is: HTML is the standard markup language used to create and structure content on the web.
Key characteristics:
- Provides the skeleton/structure of a webpage
- Uses tags (like
<html>, <head>, <body>, <p>, <div>) to define elements
- Not a programming language - it's a markup language
- Current version is HTML5
Basic HTML document structure:
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h1>My First Heading</h1>
<p>My first paragraph.</p>
</body>
</html>
CSS (Cascading Style Sheets)
What it is: CSS is the language used to style and layout web pages.
Key characteristics:
- Controls presentation, formatting, and appearance
- Works with HTML to make pages visually appealing
- Uses selectors to target HTML elements
- Current version is CSS3
Basic CSS example:
body {
background-color: lightblue;
}
h1 {
color: white;
text-align: center;
}
p {
font-family: verdana;
font-size: 20px;
}
How They Work Together
- HTML defines the content and structure ("This is a heading, this is a paragraph")
- CSS defines the presentation ("The heading should be red and centered, paragraphs should use Arial font")
Methods of applying CSS:
- Inline (using the
style attribute in HTML elements)
- Internal (using
<style> tags in the HTML <head>)
- External (linking to a separate
.css file - most recommended method)
Key Concepts
HTML:
- Semantic elements (
<header>, <footer>, <article>)
- Forms and inputs
- Links and navigation
- Images and multimedia
CSS:
- Selectors (element, class, ID)
- Box model (margin, border, padding, content)
- Positioning (static, relative, absolute, fixed)
- Flexbox and Grid layout systems
- Responsive design (media queries)
Together, HTML and CSS form the foundation of nearly every website on the internet.