Design comparison
Solution retrospective
Two issues I can't seem to solve myself:
- I tried to add media query but it didn't work as intent and anything I put under was completely ignored.
/* Media query for mobile screens (up to 375px) */
@media only screen and (max-width: 375px) {
body {
padding-bottom: 0;
padding-top: 0;
}
.container {
max-width: 100%;
padding: 0; /* No padding for mobile screens */
}
.container > img {
border-radius: 0; /* No border radius for mobile screens */
object-fit: contain;
}
}
- I haven't figured out how to make the lines on the table the way it is shown in the design picture yet.
Community feedback
- @osmanbay90Posted 9 months ago
Great job on completing the Frontend Mentor challenge! Your project shows promise, but here are some areas where you could make improvements in your HTML and CSS:
Media Query Not Working: Your media query seems to be well-formed, but it might not be effective due to specificity issues. Ensure that the CSS rules within your
media query
are overriding the rules defined outside of it. To ensure this, you may need to increase the specificity of your media query selectors. Try adding!important
to your mobile-specific rules temporarily to see if they take effect. If they do, it suggests a specificity problem. Also, make sure your media query is placed after the main CSS rules, so it can override them.Styling Table Lines: To achieve the table lines styling as shown in the design picture, you can use CSS
border properties.
Specifically, set borders on the<td>
elements to create lines between them. Here's how you can modify your CSS:CSS code
- CSS for table
table { width: 100%; border-collapse: collapse; } th, td { border: 1px solid var(--LightGrey); /* Add borders to cells */ }
By setting a border on both
<th>
and<td>
elements, you'll get the lines you desire. Adjust the border properties as needed to match your design.Additionally, here are some improvements you might consider:
Organizing CSS: Group related CSS rules together for better readability and maintenance.
Consistent Indentation: Maintain consistent indentation for better code readability.
Accessibility: Ensure your website is accessible to all users, for example, by providing alternative text for images (alt attribute).
Responsive Design: Check responsiveness on various devices and adjust styles as needed. Test your media queries thoroughly to ensure they work as expected.
Remember, practice makes perfect! Keep refining your skills by tackling more challenges on Frontend Mentor. Happy coding! š
Marked as helpful0
Please log in to post a comment
Log in with GitHubJoin our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord