Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

使用HTML和CSS完成 Done using HTML and CSS

@DerRight

Desktop design screenshot for the Blog preview card coding challenge

This is a solution for...

  • HTML
  • CSS
1newbie
View challenge

Design comparison


SolutionDesign

Solution retrospective


What are you most proud of, and what would you do differently next time?

依照Figma上面的格式製作,由於有了Figma的幫助,很快就完成了這題!

Follow the format on Figma. Thanks to the help of Figma, this question was completed quickly!

What challenges did you encounter, and how did you overcome them?

這一題基本上沒有遇到甚麼挑戰,更像是讓你熟悉HTML的元件排版、使用和CSS的熟悉程度!

This question basically does not pose any challenges, it is more about making you familiar with the layout and use of HTML components and the familiarity with CSS!

What specific areas of your project would you like help with?

因為我的排版很粗糙,幾乎都是一個div一個元件,然後css也擠在一團,但是這是我最盡力之後的成品!希望可以跟各位多多指教!

Because my layout is very rough, almost one div and one element, and the css is also crowded together, but this is the finished product after my best efforts! I hope I can give you some advice!

Community feedback

P
Steven Stroud 11,850

@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 like px or %, as they don't adapt well to changes in font size or layout.

  • While px is useful for precise, fixed sizing, such as border-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, using px 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 like rem and adjust based on the user’s preferences and device settings, making your design more flexible and accessible. Use px 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

1

@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!

0
P
Steven Stroud 11,850

@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

1

@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!!!!!!!!!

1
P
Steven Stroud 11,850

@Stroudy

Posted

Hey @DerRight, No problem dude, Divs still have there usefulness, divs are good for layout, grouping elements.

Marked as helpful

1

@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!!!!!!!

1
P
Steven Stroud 11,850

@Stroudy

Posted

Hey @DerRight, No doubt you got this! 💪

Marked as helpful

1

Please log in to post a comment

Log in with GitHub
Discord logo

Join 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