Introduction to HTML, CSS, and JavaScript
HTML, CSS, and JavaScript are the three core technologies used in web development. HTML defines the structure and content of a web page, CSS is used for styling and layout, and JavaScript enables interactivity and dynamic content.
HTML Structure and Elements
HTML (Hypertext Markup Language) is used to create the structure of a web page. It uses tags (also called elements) to define different parts of the content, such as headings, paragraphs, lists, and images.
Example:
<!DOCTYPE html>
<html>
<head>
<title>My Web Page</title>
</head>
<body>
<h1>Welcome to My Web Page</h1>
<p>This is a paragraph.</p>
<ul>
<li>Item 1</li>
<li>Item 2</li>
</ul>
</body>
</html>
CSS Selectors, Properties, and Styling
CSS (Cascading Style Sheets) is used to style and lay out web pages. It uses selectors to target HTML elements and apply styles through properties and values.
Example:
/* In a separate .css file or in a <style> tag in the HTML document */
h1 {
color: blue;
font-family: Arial, sans-serif;
}
p {
font-size: 16px;
line-height: 1.5;
}
JavaScript Basics: Variables, Loops, Functions, Events
JavaScript is a programming language that enables interactivity and dynamic content on web pages. It can be used to manipulate HTML elements, respond to user events, and communicate with servers.
Example:
// In a separate .js file or in a <script> tag in the HTML document
document.addEventListener('DOMContentLoaded', function() {
var button = document.getElementById('myButton');
button.addEventListener('click', function() {
alert('Button clicked!');
});
});
Hands-on Exercises
- Create a simple web page using HTML, CSS, and JavaScript.
- Use JavaScript to modify the content of an HTML element on the page.
- Create a basic form and use JavaScript to validate the input and display an error message if the input is invalid.
Real-World Example
HTML, CSS, and JavaScript are essential skills for web developers, as they are used to build and maintain websites, web applications, and user interfaces.
Additional Resources
- Mozilla Developer Network (MDN) Web Docs: https://developer.mozilla.org/
- W3Schools: https://www.w3schools.com/
- freeCodeCamp: https://www.freecodecamp.org/
Review Questions
- What are the roles of HTML, CSS, and JavaScript in web development?
- Describe the basic structure of an HTML document.
- How do you use CSS selectors to target and style HTML elements?
- Explain how JavaScript can be used to manipulate HTML elements and respond to user events.
Summary and Next Steps
In this lesson, you learned about:
- HTML, CSS, and JavaScript basics
- HTML structure and elements
- CSS selectors, properties, and styling
- JavaScript fundamentals, such as variables, loops, functions, and events
With these foundational skills, you can now start learning more advanced web development topics and frameworks.
Remember to review the material periodically and practice your skills to reinforce your learning. Good luck on your journey to becoming a Python developer!



