Welcome to the HTML section of JD Academy! In this module, you'll embark on a journey to master the fundamental language of the web—HTML. As the backbone of every web page, HTML allows you to structure content and create a seamless browsing experience for users.
Early Styling (1996-1997): The need for a separate styling language led to the development of CSS. CSS1 was introduced in 1996-1997.
CSS2 (1998): This version expanded CSS capabilities, introducing features like absolute, relative positioning, and media types.
CSS3 (2001-present): Rather than being a single specification, CSS3 is a collection of individual modules introduced progressively. It includes features like animations, transitions, and responsive design.
Separation of Concerns: CSS allows the separation of content and presentation, making code more maintainable.
Consistency: Styles can be applied consistently across multiple pages.
Adaptability CSS3 introduced a range of features for responsive design and modern styling.
Browser Compatibility: Ensuring consistent rendering across different browsers can be challenging.
Learning Curve: Mastering CSS, especially advanced features, can be complex for beginners.
CSS, or Cascading Style Sheets, is a language used to describe the visual presentation of a document written in HTML.
It defines how elements should be styled, ensuring a consistent and appealing design across web pages.
Understanding the role of CSS in separating content and presentation.
The benefits of modularizing styles for easier maintenance.
Exploring different methods to include CSS in your HTML document—inline, internal, and external stylesheets.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My Awesome Website</title>
<style>
body {
font-family: 'Arial', sans-serif;
background-color: #f4f4f4;
color: #333;
}
h1 {
color: #008080;
}
</style>
</head>
<body>
<h1>Welcome to My Awesome Website</h1>
<p>This is a simple example to demonstrate CSS integration.</p>
</body>
</html>
Learning about various selectors to target HTML elements for styling.
Covering basic selectors, class selectors, ID selectors, and descendant selectors.
A deep dive into common CSS properties such as 'color', 'font-size', 'margin', 'padding', and their impact on element styling.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Selectors and Properties</title>
<style>
/* Basic Selector */
p {
font-size: 16px;
color: #333;
}
/* Class Selector */
.highlight {
background-color: #ffeeba;
}
/* ID Selector */
#header {
font-size: 24px;
}
</style>
</head>
<body>
<p>This is a basic paragraph.</p>
<p class="highlight">This paragraph has a highlight class.</p>
<h2 id="header">This is a header with an ID.</h2>
</body>
</html>
Understanding how styles cascade and how to resolve conflicts. Exploring the importance of order, importance, specificity, and inheritance.
Grasping the concept of specificity and how it determines which styles take precedence in complex scenarios.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Cascade and Specificity</title>
<style>
/* Specificity Example */
body p {
color: #008080; /* More specific than just p selector */
}
/* Importance Example */
h1 {
color: red !important; /* Overrides other styles with higher specificity */
}
</style>
</head>
<body>
<p>This paragraph inherits styles from the body.</p>
<h1>This heading has important styles.</h1>
</body>
</html>
Breaking down the box model into 'content', 'padding', 'border', and 'margin'. How each component affects the overall layout.
The difference between 'box-sizing: content-box' and 'box-sizing: border-box' and how it influences element dimensions.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Box Model and Box Sizing</title>
<style>
/* Box Model Example */
.box {
width: 200px;
padding: 20px;
border: 1px solid #ccc;
margin: 10px;
}
/* Box Sizing Example */
.border-box {
box-sizing: border-box;
}
</style>
</head>
<body>
<div class="box">This is a box with the box model.</div>
<div class="box border-box">This is a box with border-box sizing.
</div>
</body>
</html>
Exploring the Flexbox layout model for one-dimensional layouts. Understanding the concepts of flex containers and flex items.
Key properties like 'flex-direction', 'justify-content', 'align-items', and 'flex' to create flexible and responsive designs.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Flexbox Layout</title>
<style>
/* Flex Container Example */
.flex-container {
display: flex;
justify-content: space-between;
}
/* Flex Item Example */
.flex-item {
flex: 1;
}
</style>
</head>
<body>
<div class="flex-container">
<div class="flex-item">Item 1</div>
<div class="flex-item">Item 2</div>
<div class="flex-item">Item 3</div>
</div>
</body>
</html>
Introducing the two-dimensional layout system with CSS Grid. Understanding the grid container and grid items.
Exploring properties like 'grid-template-columns', 'grid-template-rows', and 'grid-gap' for creating versatile layouts.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CSS Grid Layout</title>
<style>
/* Grid Container Example */
.grid-container {
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-gap: 20px;
}
/* Grid Item Example */
.grid-item {
grid-column: span 2;
}
</style>
</head>
<body>
<div class="grid-container">
<div class="grid-item">Item 1</div>
<div class="grid-item">Item 2</div>
<div class="grid-item">Item 3</div>
<div class="grid-item">Item 4</div>
<div class="grid-item">Item 5</div>
<div class="grid-item">Item 6</div>
</div>
</body>
</html>
Embracing the mobile-first design philosophy and its advantages. Starting with a small screen design and progressively enhancing for larger screens.
Understanding the role of the viewport meta tag in making web pages responsive.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Responsive Design</title>
<style>
/* Mobile Styles */
body {
font-size: 14px;
}
/* Desktop Styles (Media Query) */
@media screen and (min-width: 600px) {
body {
font-size: 16px;
}
}
</style>
</head>
<body>
<p>This is a responsive paragraph.</p>
</body>
</html>
Writing media queries to apply specific styles based on device characteristics such as screen width, height, and orientation.
Defining breakpoints and adjusting styles for different screen sizes.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Media Queries</title>
<style>
/* Default Styles */
/* Tablet Styles (Media Query) */
@media screen and (min-width: 600px) {
/* Styles for tablets and larger screens */
}
/* Desktop Styles (Media Query) */
@media screen and (min-width: 1024px) {
/* Styles for desktop screens */
}
</style>
</head>
<body>
<p>This is a paragraph with media queries.
</p>
</body>
</html>
Introduction to transitions and how they smoothly animate changes in property values over a specified duration
Exploring properties like 'transition-property', 'transition-duration', and 'transition-timing-function'.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CSS Transitions</title>
<style>
/* Transition Example */
button {
transition: background-color 0.3s ease;
}
button:hover {
background-color: #008080;
}
</style>
</head>
<body>
<button>Hover Me</button>
</body>
</html>
Creating animations using keyframes to define stages of motion.
Understanding properties like 'animation-name', 'animation-duration', and 'animation-delay'.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CSS Animations</title>
<style>
/* Keyframes Animation Example */
@keyframes slideIn {
from {
transform: translateX(-100%);
}
to {
transform: translateX(0);
}
}
.animated-element {
animation: slideIn 1s ease-in-out;
}
</style>
</head>
<body>
<div class="animated-element">This element slides in.
</div>
</body>
</html>
Exploring the power of CSS variables for creating reusable values. How to declare and use variables in your stylesheets.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CSS Variables</title>
<style>
/* CSS Variables Example */
:root {
--primary-color: #3498db;
}
.button {
background-color: var(--primary-color);
}
</style>
</head>
<body>
<button class="button">Click Me</button>
</body>
</html>
Applying filter effects such as blur, brightness, and contrast to elements.
Understanding blend modes for creative and visually appealing designs.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CSS Filters and Blend Modes</title>
<style>
/* Filter Effects Example */
.blurred-image {
filter: blur(5px);
}
/* Blend Modes Example */
.overlay {
mix-blend-mode: overlay;
}
</style>
</head>
<body>
<img src="image.jpg" alt="Blurred Image" class="blurred-image">
<div class="overlay">This text has an overlay blend mode.
</div>
</body>
</html>
An in-depth look at the subgrid feature in CSS Grid, enabling nested grid structures.
Advanced grid layout techniques for complex and responsive designs.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CSS Grid and Subgrid</title>
<style>
/* CSS Subgrid Example */
.grid-container {
display: grid;
grid-template-columns: repeat(2, 1fr);
grid-gap: 20px;
}
.nested-grid {
display: grid;
grid-template-columns: subgrid;
}
</style>
</head>
<body>
<div class="grid-container">
<div class="nested-grid">Item 1</div>
<div class="nested-grid">Item 2</div>
<div class="nested-grid">Item 3</div>
<div class="nested-grid">Item 4</div>
</div>
</body>
</html>
Going beyond variables—how custom properties can be used for more dynamic styling.
Understanding mixins and how they contribute to maintainable and modular styles.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Custom Properties and Mixins</title>
<style>
/* Custom Properties Example */
:root {
--primary-color: #3498db;
}
.button {
background-color: var(--primary-color);
}
/* Mixins Example */
@mixin border-radius($radius) {
border-radius: $radius;
}
.rounded-element {
@include border-radius(10px);
}
</style>
</head>
<body>
<button class="button">Click Me</button>
<div class="rounded-element">This element has rounded corners.</div>
</body>
</html>
Strategies for writing clean, readable, and maintainable CSS code. The importance of consistent formatting and organization.
Techniques for optimizing CSS performance, including minimizing file size and reducing render times.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CSS Best Practices</title>
<style>
/* Best Practices Example */
/* Be consistent with indentation and spacing */
.element {
margin: 10px;
padding: 5px;
}
/* Performance Optimization Example */
.large-image {
background: url('large-image.jpg') no-repeat;
background-size: cover;
}
</style>
</head>
<body>
<div class="element">This is an example of clean code.</div>
<div class="large-image">This is an example of optimized image usage.</div>
</body>
</html>
Dealing with vendor prefixes for compatibility across different browsers.
Using feature queries to apply styles based on browser support for specific CSS features.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Cross-Browser Compatibility</title>
<style>
/* Browser Prefixes Example */
.box {
-webkit-box-shadow: 0px 0px 10px #000;
box-shadow: 0px 0px 10px #000;
}
/* Feature Queries Example */
@supports (display: grid) {
.grid-layout {
display: grid;
}
}
</style>
</head>
<body>
<div class="box">This box has a shadow with browser prefixes.</div>
<div class="grid-layout">This layout uses grid with feature queries.</div>
</body>
</html>
Objective: Create a personal portfolio website to showcase skills, projects, and contact information.
Objective: Build a landing page for a fictional product or service.
Objective: Develop a recipe book website where users can explore and search for recipes.
Objective: Create a travel blog website with information about different travel destinations.
Objective: Build an online resume website to showcase personal and professional details.
Objective: Develop a website for counting down to a future event.
Objective: Build a news magazine website with sections for different categories.
Objective: Create a simple e-commerce storefront website.
“Talk is cheap. Show me the code.”