If you've ever wanted to build your own website but didn't know where to start, HTML and CSS are the perfect place.
Every website you visit, from a simple personal portfolio to a complex web application, relies on technologies that structure and present information in a browser.
Two of the most important technologies are HTML and CSS.
In this tutorial, we'll start from zero and build a small, responsive profile card using HTML and CSS. You don't need previous programming experience.
By the end, you'll understand how webpages are structured, how CSS styles them, and how to create your first working web interface.
1. What Are HTML and CSS?
Before writing code, let's understand what these technologies actually do.
HTML (HyperText Markup Language) defines the structure and content of a webpage.
It tells the browser what elements exist, such as:
- Headings
- Paragraphs
- Images
- Links
- Buttons
- Forms
- Navigation menus
CSS (Cascading Style Sheets) controls how those elements look.
It handles:
- Colors and backgrounds
- Fonts and typography
- Spacing and alignment
- Layouts
- Borders and shadows
- Responsive designs
- Animations and transitions
Think of a website as a house:
- HTML is the structure and rooms.
- CSS is the interior design and appearance.
- JavaScript adds interactive behavior.
You can build a webpage using HTML alone, but CSS makes it visually appealing and easier to use.
2. What Do You Need to Get Started?
You don't need expensive software or a complicated development environment.
You'll need:
- A computer.
- A modern web browser such as Chrome or Firefox.
- A code editor.
I recommend Visual Studio Code (VS Code).
Create a folder named my-first-website.
Inside that folder, create two files:
index.htmlstyle.css
Your project structure should look like this:
my-first-website/ │ ├── index.html └── style.css That's everything we need for our first project.
3. Create Your First HTML Page
Open index.html and add the following code:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>My First Website</title> <link rel="stylesheet" href="style.css"> </head> <body> <h1>Hello, World!</h1> <p> Welcome to my first website. I'm learning HTML and CSS! </p> </body> </html> Let's understand the important parts.
<!DOCTYPE html>
Tells the browser to interpret the document using modern HTML.
<html lang="en">
The root element of the HTML document. The language attribute identifies the page language.
<head>
Contains information about the document, including its title, metadata, and stylesheet references.
<title>
Defines the browser tab title.
<body>
Contains the content displayed on the webpage.
<h1>
Creates the main heading.
<p>
Defines a paragraph.
Save the file and open index.html in your browser.
Congratulations! You've just created your first webpage.
4. Understand HTML Elements and Attributes
HTML uses elements to organize content.
For example:
<h1>Learn Web Development</h1> <p>Start building websites today.</p> <a href="https://example.com"> Visit Website </a> <img src="image.jpg" alt="A sample image"> An HTML element generally consists of:
- An opening tag.
- Some content.
- A closing tag.
Attributes provide additional information about an element.
For example, href specifies a link destination, while src specifies an image source.
Some elements, such as <img>, don't require a closing tag.
Understanding elements and attributes is fundamental to writing clean HTML.
5. Add CSS to Style Your Website
Our webpage currently looks very basic.
Let's improve it with CSS.
Open style.css and write:
* { margin: 0; padding: 0; box-sizing: border-box; } body { font-family: Arial, sans-serif; background: #f1f5f9; color: #1e293b; padding: 40px; } h1 { color: #2563eb; margin-bottom: 15px; } p { font-size: 18px; line-height: 1.6; } Save the file and refresh your browser.
You'll notice that the heading has changed color, the paragraph is easier to read, and the page has some breathing room.
Let's understand a few CSS concepts.
CSS Selectors
Selectors identify which HTML elements should receive styles.
h1 { color: blue; } This targets all <h1> elements.
CSS Properties
Properties define what you want to change.
Examples include:
colorbackgroundfont-sizemarginpaddingborder
CSS Values
Values determine how a property behaves.
For example:
font-size: 24px; Here, font-size is the property and 24px is its value.
6. Build a Complete Profile Card
Now let's combine everything into a small project.
We'll create a modern profile card with:
- A profile image.
- A name and job title.
- A short description.
- A contact button.
- A responsive layout.
Replace the contents of index.html with:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>My Profile Card</title> <link rel="stylesheet" href="style.css"> </head> <body> <main class="profile-card"> <img src="https://placehold.co/120x120" alt="Profile placeholder" class="profile-image" > <h1>Alex Morgan</h1> <h2>Frontend Developer</h2> <p> I enjoy creating modern websites and learning new technologies. </p> <a href="mailto:hello@example.com" class="contact-btn"> Contact Me </a> </main> </body> </html> Now add the following CSS to style.css:
* { margin: 0; padding: 0; box-sizing: border-box; } body { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: #0f172a; font-family: Arial, sans-serif; } .profile-card { width: 100%; max-width: 350px; padding: 35px 25px; text-align: center; background: #1e293b; border-radius: 20px; color: white; box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3); } .profile-image { width: 120px; height: 120px; border-radius: 50%; object-fit: cover; margin-bottom: 20px; border: 4px solid #38bdf8; } .profile-card h1 { font-size: 26px; margin-bottom: 8px; } .profile-card h2 { font-size: 16px; color: #38bdf8; margin-bottom: 15px; } .profile-card p { color: #cbd5e1; line-height: 1.6; margin-bottom: 25px; } .contact-btn { display: inline-block; padding: 12px 25px; background: #2563eb; color: white; text-decoration: none; border-radius: 8px; transition: background 0.3s ease; } .contact-btn:hover { background: #1d4ed8; } What did we learn from this project?
We used several important CSS concepts:
-
display: gridto center the profile card. -
max-widthto control its maximum size. -
border-radiusto create rounded corners. -
box-shadowto add depth. -
transitionto animate hover changes. -
:hoverto change the button's appearance.
We also used object-fit: cover to make the profile image fit its circular container.
Notice something important: We didn't need JavaScript to create this interface. HTML and CSS were enough.
7. Make Your Website Responsive
A website should work on different screen sizes.
Our profile card already uses a flexible width and a maximum width, which helps it adapt to smaller screens.
For more complex layouts, CSS media queries allow you to apply styles depending on the viewport size.
For example:
@media (max-width: 480px) { .profile-card { padding: 25px 18px; } .profile-card h1 { font-size: 22px; } .profile-image { width: 100px; height: 100px; } } This makes some elements smaller on mobile devices.
Responsive design is an essential skill for modern frontend developers.
8. Common Mistakes Beginners Should Avoid
When learning HTML and CSS, beginners often make a few common mistakes.
1. Forgetting to link the CSS file
Make sure your HTML contains:
<link rel="stylesheet" href="style.css"> Also check that both files are in the correct folder.
2. Using too many <div> elements
HTML provides semantic elements such as <header>, <nav>, <main>, <section>, and <footer>.
Use elements that describe the purpose of your content whenever appropriate.
3. Ignoring mobile screens
Always test your webpages at different viewport widths.
4. Writing CSS without understanding selectors
Learn the difference between element, class, and ID selectors before moving into advanced styling.
5. Copying code without experimenting
Change colors, spacing, fonts, and layouts. Experimentation is one of the best ways to understand how CSS works.
9. What Should You Learn Next?
Once you understand the basics, follow a structured learning path.
HTML learning path
- HTML document structure.
- Headings and paragraphs.
- Links and images.
- Lists and tables.
- Forms and input fields.
- Semantic HTML.
- HTML accessibility.
- Metadata and SEO fundamentals.
CSS learning path
- Selectors and specificity.
- Colors and backgrounds.
- Box model.
- Display and positioning.
- Flexbox.
- CSS Grid.
- Responsive design.
- Transitions and animations.
- Advanced CSS techniques.
You can explore free HTML and CSS learning resources at MAKUIStudio.
The goal is to understand each concept, practice it, and gradually build more complex projects.
10. Practice With Free Code Examples
Reading tutorials is useful, but building things yourself is what develops practical skills.
Try creating these projects next:
- Personal portfolio card.
- Responsive navigation bar.
- Login and registration form.
- Pricing cards.
- Landing page.
- Responsive image gallery.
- Modern dashboard layout.
You can also explore MAKUIStudio for free programming courses and reusable HTML/CSS code examples.
Use snippets as learning material: study the structure, experiment with the styles, and customize the code for your own projects.
Final Thoughts
Learning web development doesn't have to be complicated.
HTML gives your website structure, while CSS brings that structure to life through styling and layout.
Start with simple webpages, practice regularly, and gradually move toward more advanced projects.
You don't need to master everything in one day. Consistency and hands-on practice matter much more than memorizing hundreds of properties.
Your turn!
Have you already built your first website, or are you just starting with HTML and CSS?
Share your experience in the comments. I'd love to know what you're building!
Continue Learning: Explore free HTML, CSS, JavaScript, and Python learning resources at MAKUIStudio.



