CSS challenges
Practice problem statements with input format, output format, constraints and solutions.
CSS Introduction challenge
Build a small solution that uses CSS Introduction in CSS and handles one normal case plus one edge case.
Input format
Use a short text value, array, query, or sample object depending on the topic.
Output format
Print, render, or return the processed result in a readable format.
Constraints
- Keep the solution under 60 lines.
- Use descriptive names.
- Do not depend on hidden external services.
Starter code
.lesson-card {
display: grid;
gap: 12px;
padding: 16px;
border: 1px solid #dbeafe;
border-radius: 8px;
background: #ffffff;
}Test cases
- basic sample - valid processed result
- empty or small sample - safe fallback result
Hint
Focus on the core css introduction pattern before polishing the final output.
Solution
.lesson-card {
display: grid;
gap: 12px;
padding: 16px;
border: 1px solid #dbeafe;
border-radius: 8px;
background: #ffffff;
}Syntax challenge
Build a small solution that uses Syntax in CSS and handles one normal case plus one edge case.
Input format
Use a short text value, array, query, or sample object depending on the topic.
Output format
Print, render, or return the processed result in a readable format.
Constraints
- Keep the solution under 60 lines.
- Use descriptive names.
- Do not depend on hidden external services.
Starter code
.lesson-card {
display: grid;
gap: 12px;
padding: 16px;
border: 1px solid #dbeafe;
border-radius: 8px;
background: #ffffff;
}Test cases
- basic sample - valid processed result
- empty or small sample - safe fallback result
Hint
Focus on the core syntax pattern before polishing the final output.
Solution
.lesson-card {
display: grid;
gap: 12px;
padding: 16px;
border: 1px solid #dbeafe;
border-radius: 8px;
background: #ffffff;
}Selectors challenge
Build a small solution that uses Selectors in CSS and handles one normal case plus one edge case.
Input format
Use a short text value, array, query, or sample object depending on the topic.
Output format
Print, render, or return the processed result in a readable format.
Constraints
- Keep the solution under 60 lines.
- Use descriptive names.
- Do not depend on hidden external services.
Starter code
.lesson-card {
display: grid;
gap: 12px;
padding: 16px;
border: 1px solid #dbeafe;
border-radius: 8px;
background: #ffffff;
}Test cases
- basic sample - valid processed result
- empty or small sample - safe fallback result
Hint
Focus on the core selectors pattern before polishing the final output.
Solution
.lesson-card {
display: grid;
gap: 12px;
padding: 16px;
border: 1px solid #dbeafe;
border-radius: 8px;
background: #ffffff;
}Colors challenge
Build a small solution that uses Colors in CSS and handles one normal case plus one edge case.
Input format
Use a short text value, array, query, or sample object depending on the topic.
Output format
Print, render, or return the processed result in a readable format.
Constraints
- Keep the solution under 60 lines.
- Use descriptive names.
- Do not depend on hidden external services.
Starter code
.lesson-card {
display: grid;
gap: 12px;
padding: 16px;
border: 1px solid #dbeafe;
border-radius: 8px;
background: #ffffff;
}Test cases
- basic sample - valid processed result
- empty or small sample - safe fallback result
Hint
Focus on the core colors pattern before polishing the final output.
Solution
.lesson-card {
display: grid;
gap: 12px;
padding: 16px;
border: 1px solid #dbeafe;
border-radius: 8px;
background: #ffffff;
}Backgrounds challenge
Build a small solution that uses Backgrounds in CSS and handles one normal case plus one edge case.
Input format
Use a short text value, array, query, or sample object depending on the topic.
Output format
Print, render, or return the processed result in a readable format.
Constraints
- Keep the solution under 60 lines.
- Use descriptive names.
- Do not depend on hidden external services.
Starter code
.lesson-card {
display: grid;
gap: 12px;
padding: 16px;
border: 1px solid #dbeafe;
border-radius: 8px;
background: #ffffff;
}Test cases
- basic sample - valid processed result
- empty or small sample - safe fallback result
Hint
Focus on the core backgrounds pattern before polishing the final output.
Solution
.lesson-card {
display: grid;
gap: 12px;
padding: 16px;
border: 1px solid #dbeafe;
border-radius: 8px;
background: #ffffff;
}Borders challenge
Build a small solution that uses Borders in CSS and handles one normal case plus one edge case.
Input format
Use a short text value, array, query, or sample object depending on the topic.
Output format
Print, render, or return the processed result in a readable format.
Constraints
- Keep the solution under 60 lines.
- Use descriptive names.
- Do not depend on hidden external services.
Starter code
.lesson-card {
display: grid;
gap: 12px;
padding: 16px;
border: 1px solid #dbeafe;
border-radius: 8px;
background: #ffffff;
}Test cases
- basic sample - valid processed result
- empty or small sample - safe fallback result
Hint
Focus on the core borders pattern before polishing the final output.
Solution
.lesson-card {
display: grid;
gap: 12px;
padding: 16px;
border: 1px solid #dbeafe;
border-radius: 8px;
background: #ffffff;
}Margins challenge
Build a small solution that uses Margins in CSS and handles one normal case plus one edge case.
Input format
Use a short text value, array, query, or sample object depending on the topic.
Output format
Print, render, or return the processed result in a readable format.
Constraints
- Keep the solution under 60 lines.
- Use descriptive names.
- Do not depend on hidden external services.
Starter code
.lesson-card {
display: grid;
gap: 12px;
padding: 16px;
border: 1px solid #dbeafe;
border-radius: 8px;
background: #ffffff;
}Test cases
- basic sample - valid processed result
- empty or small sample - safe fallback result
Hint
Focus on the core margins pattern before polishing the final output.
Solution
.lesson-card {
display: grid;
gap: 12px;
padding: 16px;
border: 1px solid #dbeafe;
border-radius: 8px;
background: #ffffff;
}Padding challenge
Build a small solution that uses Padding in CSS and handles one normal case plus one edge case.
Input format
Use a short text value, array, query, or sample object depending on the topic.
Output format
Print, render, or return the processed result in a readable format.
Constraints
- Keep the solution under 60 lines.
- Use descriptive names.
- Do not depend on hidden external services.
Starter code
.lesson-card {
display: grid;
gap: 12px;
padding: 16px;
border: 1px solid #dbeafe;
border-radius: 8px;
background: #ffffff;
}Test cases
- basic sample - valid processed result
- empty or small sample - safe fallback result
Hint
Focus on the core padding pattern before polishing the final output.
Solution
.lesson-card {
display: grid;
gap: 12px;
padding: 16px;
border: 1px solid #dbeafe;
border-radius: 8px;
background: #ffffff;
}Box Model challenge
Build a small solution that uses Box Model in CSS and handles one normal case plus one edge case.
Input format
Use a short text value, array, query, or sample object depending on the topic.
Output format
Print, render, or return the processed result in a readable format.
Constraints
- Keep the solution under 60 lines.
- Use descriptive names.
- Do not depend on hidden external services.
Starter code
.lesson-card {
display: grid;
gap: 12px;
padding: 16px;
border: 1px solid #dbeafe;
border-radius: 8px;
background: #ffffff;
}Test cases
- basic sample - valid processed result
- empty or small sample - safe fallback result
Hint
Focus on the core box model pattern before polishing the final output.
Solution
.lesson-card {
display: grid;
gap: 12px;
padding: 16px;
border: 1px solid #dbeafe;
border-radius: 8px;
background: #ffffff;
}Text challenge
Build a small solution that uses Text in CSS and handles one normal case plus one edge case.
Input format
Use a short text value, array, query, or sample object depending on the topic.
Output format
Print, render, or return the processed result in a readable format.
Constraints
- Keep the solution under 60 lines.
- Use descriptive names.
- Do not depend on hidden external services.
Starter code
.lesson-card {
display: grid;
gap: 12px;
padding: 16px;
border: 1px solid #dbeafe;
border-radius: 8px;
background: #ffffff;
}Test cases
- basic sample - valid processed result
- empty or small sample - safe fallback result
Hint
Focus on the core text pattern before polishing the final output.
Solution
.lesson-card {
display: grid;
gap: 12px;
padding: 16px;
border: 1px solid #dbeafe;
border-radius: 8px;
background: #ffffff;
}