0% found this document useful (0 votes)
16 views

Medterm CSS Module For Beginners

Uploaded by

Nickola
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

Medterm CSS Module For Beginners

Uploaded by

Nickola
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

CSS Module for Beginners: Styling the Web

Module Overview

This module introduces the fundamentals of CSS (Cascading Style Sheets) and its role in web
design. By the end of the module, students will be able to apply basic styles to web pages,
understand the box model, use responsive design techniques, and build layouts with CSS Grid
and Flexbox.

Lesson 1: Introduction to CSS Syntax and Basic Selectors

Objectives:

 Understand the purpose of CSS and its syntax.


 Learn how to link CSS to an HTML document.
 Explore basic CSS selectors (tag, class, id).

Discussion: CSS is the language used to style HTML elements. It consists of selectors and
declarations.

selector {
property: value;
}

Selectors:

 Tag selectors (e.g., p, h1): Apply styles to all instances of a tag.


 Class selectors (.classname): Target specific elements with a class.
 ID selectors (#idname): Target a unique element with a specific ID.

Lesson 2: The Box Model and CSS Layout

Objectives:

 Understand the CSS box model.


 Learn about margins, borders, padding, and content.

Discussion: In CSS, every element is treated as a box. The box model consists of:

 Content: The actual text or image.


 Padding: Space between the content and the border.
 Border: A line surrounding the padding.
 Margin: Space outside the border.

.box {
margin: 10px;
padding: 20px;
border: 1px solid black;
}

Lesson 3: Styling Typography, Colors, and Backgrounds

Objectives:

 Learn how to style text (font-size, font-family, color).


 Apply colors and backgrounds to elements.

Discussion: CSS allows you to style text using properties like font-family, font-size, color,
and more.

p {
font-family: Arial, sans-serif;
font-size: 16px;
color: #333;
}

Backgrounds:

 Apply background colors: background-color.


 Use background images: background-image: url('image.jpg');.

Lesson 4: CSS Units (Pixels, Ems, Rems, Percentages)

Objectives:

 Understand the different CSS units and their usage.


 Learn when to use px, em, rem, and percentages.

Discussion:

 Pixels (px): Fixed units, ideal for small, precise elements.


 Ems (em): Relative to the parent element’s font size.
 Rems (rem): Relative to the root element’s font size.
 Percentages: Relative to the containing element’s size.
Lesson 5: Layout with Floats and Positioning

Objectives:

 Learn how to use CSS floats for layout.


 Understand the use of position (static, relative, absolute, fixed).

Discussion: Floats are an older layout technique that allows elements to "float" to the left or
right. Positioning allows elements to be placed in specific locations.

.container {
float: left;
width: 50%;
}

.box {
position: absolute;
top: 10px;
left: 20px;
}

Lesson 6: Responsive Design with CSS Grid and Flexbox

Objectives:

 Learn how to use CSS Grid and Flexbox for flexible, responsive layouts.

Discussion:

 Flexbox: Used for one-dimensional layouts (rows or columns).


 CSS Grid: Powerful two-dimensional layout tool.

Example Flexbox Layout:

.container {
display: flex;
justify-content: space-between;
}

Example Grid Layout:

.container {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
}
Lesson 7: Media Queries and Responsive Design

Objectives:

 Understand the importance of responsive design.


 Learn how to use media queries to adapt layouts to different screen sizes.

Discussion: Media queries are used to apply different styles based on screen size.

@media (max-width: 600px) {


.container {
display: block;
}
}

Lesson 8: CSS Preprocessors (Sass and Less)

Objectives:

 Introduce CSS preprocessors and their benefits.


 Learn basic Sass/LESS syntax (variables, nesting, mixins).

Discussion: CSS preprocessors like Sass and LESS allow you to write more efficient and
reusable code.

Example using Sass:

$primary-color: #3498db;

body {
background-color: $primary-color;
}

.nav {
ul {
margin: 0;
padding: 0;
}
}
Module Summary:

By the end of this module, students will:

 Understand and apply basic CSS syntax and selectors.


 Use the box model to create well-structured layouts.
 Style typography, colors, and backgrounds effectively.
 Build responsive layouts using Flexbox, CSS Grid, and media queries.
 Have a basic understanding of CSS preprocessors like Sass.

Additional Resources:

 W3Schools CSS Tutorial


 MDN Web Docs: CSS Basics

You might also like