Learn the essential principles, technologies, and best practices to create stunning, responsive, and user-friendly websites.
Understanding these fundamental principles will help you create effective and engaging website designs.
Create visual stability by distributing the visual weight of elements. Balance can be symmetrical or asymmetrical, but should feel harmonious.
Guide users through content by establishing a clear visual hierarchy that shows the relative importance of elements on the page.
Use contrast to create focal points, improve readability, and establish relationships between elements through color, size, and typography.
Group related elements together to create logical relationships and organize information for better user comprehension.
Repeat design elements throughout the site to create consistency, reinforce brand identity, and help users navigate more intuitively.
Align elements to create visual connections, organize information, and establish a clean, professional appearance.
Modern web design relies on these core technologies to create stunning, interactive websites.
HTML provides the structural foundation of web pages. It uses tags to define elements like headings, paragraphs, images, links, and more.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My Website</title>
</head>
<body>
<header>
<h1>Welcome to My Website</h1>
<nav>
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Services</a></li>
<li><a href="#">Contact</a></li>
</ul>
</nav>
</header>
<main>
<section>
<h2>About Us</h2>
<p>This is a sample paragraph about our company.</p>
</section>
</main>
<footer>
<p>© 2025 My Company. All rights reserved.</p>
</footer>
</body>
</html>
CSS controls the presentation and styling of web pages. It defines how HTML elements appear on screen, specifying colors, layouts, fonts, and animations.
/* Basic styling */
body {
font-family: 'Arial', sans-serif;
line-height: 1.6;
color: #333;
margin: 0;
padding: 0;
}
header {
background-color: #f8f9fa;
padding: 20px;
box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
nav ul {
display: flex;
list-style: none;
padding: 0;
}
nav ul li {
margin-right: 20px;
}
nav a {
text-decoration: none;
color: #333;
font-weight: bold;
transition: color 0.3s;
}
nav a:hover {
color: #007bff;
}
/* Responsive layout */
@media (max-width: 768px) {
nav ul {
flex-direction: column;
}
nav ul li {
margin-right: 0;
margin-bottom: 10px;
}
}
JavaScript adds interactivity and dynamic behavior to websites. It allows you to create features like sliders, form validation, animations, and much more.
// Simple navigation toggle for mobile
document.addEventListener('DOMContentLoaded', function() {
const navToggle = document.querySelector('.navbar-toggler');
const navMenu = document.querySelector('.navbar-collapse');
if (navToggle && navMenu) {
navToggle.addEventListener('click', function() {
navMenu.classList.toggle('show');
});
}
// Form validation example
const form = document.querySelector('#contact-form');
if (form) {
form.addEventListener('submit', function(event) {
const email = document.querySelector('#email').value;
const message = document.querySelector('#message').value;
let isValid = true;
if (!email || !email.includes('@')) {
isValid = false;
showError('email', 'Please enter a valid email address');
}
if (!message.trim()) {
isValid = false;
showError('message', 'Please enter a message');
}
if (!isValid) {
event.preventDefault();
}
});
}
function showError(fieldId, message) {
const field = document.querySelector(`#${fieldId}`);
const errorDiv = document.createElement('div');
errorDiv.className = 'error-message text-danger mt-1';
errorDiv.textContent = message;
field.classList.add('is-invalid');
field.parentNode.appendChild(errorDiv);
}
});