@Stroudy
Posted
Exceptional work! You’re showing great skill here. I’ve got a couple of minor suggestions that could make this stand out even more…
- These
<div>
should really have semantic tags like headings (<h1> to <h6>
) and paragraphs (<p>
) convey structure and meaning to content, improving accessibility, SEO, and readability by helping search engines and screen readers interpret the content.
<div class="card">
<div class="blog-image">
<img src="./assets/images/illustration-article.svg" alt="Blog Image" />
</div>
<div class="content">
<div class="learn">
Learning
</div>
<div class="date">
Published 21 Dec 2023
</div>
<div class="title">
HTML & CSS foundations
</div>
<div class="description">
These languages are the backbone of every website, defining structure, content, and presentation.
</div>
</div>
-
Overusing
<div>
tags, known as "divitis," leads to cluttered code, poor semantics, and reduced performance. Instead, use appropriate semantic elements (like<header>
,<section>
, etc.) to improve readability, accessibility, and SEO. Keep HTML clean and minimal to ensure maintainability, scalability, and better CSS structure. -
Using
font-display: swap
in your@font-face
rule improves performance by showing fallback text until the custom font loads, preventing a blank screen (flash of invisible text). The downside is a brief flash when the font switches, but it’s usually better than waiting for text to appear. -
Using a full modern CSS reset is beneficial because it removes default browser styling, creating a consistent starting point for your design across all browsers. It helps avoid unexpected layout issues and makes your styles more predictable, ensuring a uniform appearance on different devices and platforms, check out this site for a Full modern reset
-
Line height is usually unitless to scale proportionally with the font size, keeping text readable across different devices. Best practice is to use a unitless value like
1.5
for flexibility. Avoid using fixed units likepx
or%
, as they don't adapt well to changes in font size or layout. -
While
px
is useful for precise, fixed sizing, such asborder-width
,border-radius
,inline-padding
, and<img>
sizes, it has limitations. Pixels don't scale well with user settings or adapt to different devices, which can negatively impact accessibility and responsiveness. For example, usingpx
for font sizes can make text harder to read on some screens, Check this article why font-size must NEVER be in pixels. In contrast, relative units likerem
and adjust based on the user’s preferences and device settings, making your design more flexible and accessible. Usepx
where exact sizing is needed, but prefer relative units for scalable layouts. If you want a deeper explanation watch this video by Kevin Powell CSS em and rem explained. Another great resource I found useful is this px to rem converter based on the default font-size of 16 pixel.
I hope you’re finding this guidance useful! Keep refining your skills and tackling new challenges with confidence. You’re making great progress—stay motivated and keep coding with enthusiasm! 💻
Marked as helpful
@DerRight
Posted
@Stroudy Thank you very much!!!! That's the biggest help for me!!
.I used section, article, span, figure, p, h1 to fix the div structure that looked messy.
.added font-display:swap to @font-face; I feel like I need to spend a little more time getting to know it. And I also converted px to rem, the relative unit is really a lot better for px, this part helped me a lot, I still need to know more about it!
Thank you for the advice, it helped me a lot and made me really understand that there are more different ways to write HTML and CSS, and I won't give up learning!
@Stroudy
Posted
Hey @DerRight, You got this bro, The <span>
tag also has no semantic meaning, This is from mdn web docs,
The <span> HTML element is a generic inline container for phrasing content, which does not inherently represent anything. It can be used to group elements for styling purposes (using the class or id attributes), or because they share attribute values, such as lang. It should be used only when no other semantic element is appropriate. <span> is very much like a <div> element, but <div> is a block-level element whereas a <span> is an inline-level element.
[https://developer.mozilla.org/en-US/docs/Web/HTML/Element/span(https://developer.mozilla.org/en-US/docs/Web/HTML/Element/span)
I'm glad you are finding this feedback useful. Take your time, Its not a race and your on the right track!
Marked as helpful
@DerRight
Posted
@Stroudy Oh!!!! I got it!!!! I have studied the difference and use of semantic elements and non-semantic elements. You are right, semantic elements such as <p> or <h1>~<h6> should be used first, and Instead of using non-semantic elements such as <div> and <span> first.
Thank you very much!!!!!🥺 If you hadn't told me, I would still use <div> for my code. I will continue to study hard!!!!!!!!!
@Stroudy
Posted
Hey @DerRight, No problem dude, Divs still have there usefulness, divs are good for layout, grouping elements.
Marked as helpful
@DerRight
Posted
@Stroudy OK!!!Thank you!!!! I think I should learn not only when to use divs and typography, but also how to use semantic and non-semantic components. Your suggestions are of great significance to me. It has made me improve a lot and understand the use of html and css. Thank you so much!!!!!!!
@Stroudy
Posted
Hey @DerRight, No doubt you got this! 💪
Marked as helpful