Open elliotmjackson opened 1 year ago
There is a bit of a cheat that everyone uses which is css frameworks. Basically you import building blocks and just use them as opposed to doing it all yourself. bootstrap is a fairly big one. I recommend playing with it because it will feel like you're achieving more by using it. But it's important to understand how it's built, which is what you'll learn from this course.
It's obvious the course is taking you through basic structure with HTML and focusing primarily on styling, this is a good idea, its also where I will give most of my feedback.
Good Practices and Highlights:
display: flex;
for layouts is a modern approach and is quite versatile for responsive web design.Areas of Improvement:
Semantics: Instead of using
<div>
tags for sections, semantic HTML5 elements such as<header>
,<section>
, and<footer>
could be used to make the code more readable and accessible. Use more semantic HTML tags. While this is primarily an HTML consideration, your CSS can be adapted to accommodate these changes.Before:
After (assuming HTML uses
<section class="banner">
):Code Duplication: There are repeated styles. For instance,
background-color: rgb(229, 229, 229);
appears multiple times. Such repetitions can be reduced by grouping selectors. Some styles are duplicated across multiple selectors. This can be reduced for efficiency.Before:
Simplifying Selectors: Instead of nested tag selectors (e.g.,
.pizza_img img
), class-based selectors are recommended for better readability and specificity. Use more specific class selectors instead of nested tag selectors.Before:
After:
Use of
position: relative;
: There are many instances ofposition: relative;
that might not be needed. Ensure each use case is necessary, or it might make the layout harder to manage in the long run. Excessive use ofposition: relative;
can make layout management difficult.Before:
After (example):
Missing Hover Effects: It appears that navigation items or clickable elements don't have hover or active states. These can improve user experience by providing visual feedback. Implement hover or active states for better user interaction.
Example Addition (for navigation items):
Accessibility: Consider adding styles for focus states to support keyboard navigation. Styles for focus states support better keyboard navigation.
Example Addition:
z-index
: Be cautious when usingz-index
. The values used in the provided code like 3, 4, 5, and 6 might make it a bit challenging to manage layers in the future. Typically, smaller incremental values (e.g., 1, 2, 3) are easier to manage. Managez-index
in a more incremental and consistent manner.Before:
After:
Consistent measurements: Stick to a particular unit of measurement for consistency.
Before:
After:
Image Optimization: Consider adding properties to make images responsive and improve rendering.
Addition (example):
CSS Variables: Implement CSS variables for frequently used values like colors or spacings for easier maintenance and consistency.
Example Addition:
Areas of Improvement:
Typography Consistency: There are inconsistencies in font styling. The
font-weight
for the title usespx
, which isn't a valid unit for this property. Use valid units forfont-weight
.Before:
After:
Margin and Padding Inconsistencies: There are discrepancies in the margin and padding assignments across various elements. This can be streamlined for better consistency. Consider a consistent margin/padding convention.
Before:
After:
Overuse of
display: block;
: This is the default display value for many elements, and explicitly defining it is often redundant. Remove unnecessarydisplay: block;
declarations.Color Contrast: Ensure sufficient contrast between text and background colors for readability and accessibility.
Potential Concern:
Suggestion: Use tools to verify color contrast.
Inconsistent Naming Conventions: Stick to a naming convention for better readability and easier maintenance.
Before:
After (Using BEM or other conventions as a suggestion):
Non-Responsive Text: Consider responsive typography using relative units and media queries.
Browser Compatibility: Ensure compatibility across major browsers by adding vendor prefixes or using tools like Autoprefixer.
Optimization of Media Queries: Consider a mobile-first approach and enhance layouts for larger screens using media queries.
Use of
::before
for Background Images: Consider using::before
for decorative images or applying backgrounds directly to parent elements.Specificity Issues: Avoid overly specific selectors that can make it difficult to override styles later.
Semantics: Instead of using
<div>
tags for sections, semantic HTML5 elements such as<header>
,<section>
, and<footer>
could be used to make the code more readable and accessible.Code Duplication: There are repeated styles. For instance,
background-color: rgb(229, 229, 229);
appears multiple times. Such repetitions can be reduced by grouping selectors.Simplifying Selectors: Instead of nested tag selectors (e.g.,
.pizza_img img
), class-based selectors are recommended for better readability and specificity.Use of
position: relative;
: There are many instances ofposition: relative;
that might not be needed. Ensure each use case is necessary, or it might make the layout harder to manage in the long run.Missing Hover Effects: It appears that navigation items or clickable elements don't have hover or active states. These can improve user experience by providing visual feedback.
Accessibility: Consider adding styles for focus states to support keyboard navigation.
z-index: Be cautious when using
z-index
. The values used in the provided code like 3, 4, 5, and 6 might make it a bit challenging to manage layers in the future. Typically, smaller incremental values (e.g., 1, 2, 3) are easier to manage.Additional Recommendations:
In summary, the code is fairly structured and provides a decent foundation for a responsive website. However, there are areas of improvement especially concerning semantics, code organization, and accessibility. NOTE: some of these recommendations may be more advanced topics, it's worth reading about anything that doesn't make sense but feel free to skip anything you feel may be jumping the gun.