CS104 CHAPTER 5
CS104 CHAPTER 5
Midterm
Advanced HTML & CSS (Chapter 5)
I. Lecture Overview:
➢ What is Responsive Design? A design approach ensuring your website looks and functions
flawlessly across various devices (desktops, laptops, tablets, smartphones).
➢ Core Techniques:
1. Fluid Grids: Use percentages (%) instead of fixed pixels (px) for columns and elements,
allowing content to flow naturally across different screen sizes.
.container {
2. Flexible Images: Images scale proportionally to their container using max-width: 100%;
and height: auto; to prevent overflow.
img {
max-width: 100%;
height: auto;
3. Media Queries: CSS rules applied only when specific conditions are met, such as screen
size, orientation, or resolution.
.sidebar {
PREPARED BY: JEFFREY G. BERNADAS – INSTRUCTOR HERCOR COLEGE, COLLEGE OF COMPUTER STUDIES
1
2
CS104 – WEB DESIGN PROJECT
nav ul {
• What are CSS Frameworks? Pre-written CSS libraries providing a consistent structure, pre-made
components (buttons, navigation, grids), and responsive design features.
• Benefits:
• Popular Frameworks:
➢ Flexbox: A powerful layout module for efficiently arranging elements in one-dimensional rows or
columns.
.container {
display: flex;
➢ Grid Layout: Excel at creating complex two-dimensional layouts with rows and columns, more
powerful than traditional float-based grids.
.grid-container {
display: grid;
grid-template-columns: 1fr 2fr; /* Two columns, second twice the width of the first */
PREPARED BY: JEFFREY G. BERNADAS – INSTRUCTOR HERCOR COLEGE, COLLEGE OF COMPUTER STUDIES
2
3
CS104 – WEB DESIGN PROJECT
➢ CSS Animations: Create captivating animations and transitions without JavaScript, enhancing
user experience and interactivity.
.button:hover {
@keyframes pulse {
0% { transform: scale(1); }
Start with a Basic HTML Structure: Include viewport meta tag for mobile responsiveness.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Responsive Layout</title>
</head>
<body>
</body>
</html>
1. Implement Fluid Grid: Divide your layout into columns using percentages for widths.
PREPARED BY: JEFFREY G. BERNADAS – INSTRUCTOR HERCOR COLEGE, COLLEGE OF COMPUTER STUDIES
3
4
CS104 – WEB DESIGN PROJECT
2. Use Flexible Images: Apply max-width: 100%; and height: auto; to images.
3. Apply Media Queries: Define breakpoints (e.g., 768px, 1024px) and adjust layout and styles for
different screen sizes.
1. Browser Developer Tools: Most modern browsers have built-in responsive design testing tools.
3. Physical Devices: Testing on real devices is crucial to identify and fix issues specific to certain
devices or operating systems.
➢ Embrace Mobile-First Thinking: Design for smaller screens first and progressively enhance for
larger screens.
➢ Use a CSS Framework for Efficiency: Leverage the pre-built components and responsive
features.
➢ Test Thoroughly on Multiple Devices: Ensure your design works flawlessly across different
screen sizes, browsers, and devices.
➢ Keep Code Organized: Use comments and consistent naming conventions for maintainability.
➢ Continuously Explore New Techniques: Web development is ever-evolving; stay curious and
explore new tools and techniques.
PREPARED BY: JEFFREY G. BERNADAS – INSTRUCTOR HERCOR COLEGE, COLLEGE OF COMPUTER STUDIES
4