Home Web Front-end CSS Tutorial My submission for the Frontend Challenge (Dec&#

My submission for the Frontend Challenge (Dec&#

Dec 31, 2024 pm 10:53 PM

This is a submission for Frontend Challenge - December Edition, Glam Up My Markup: Winter Solstice

What I Built

The website is live here: https://plutonium-239.github.io/dev.to-frontend-challenge/
My goal was to make the given plain HTML more interactive ?, beautiful ? and useful ?. I did this by adding consistent styling to all the sections, highlighting important terms for grasping content quicker while also adding more contrast. I also optimized the site for a mobile layout and while it features less interaction, the site is equally well-themed and useful.

Demo

The source code is publicly available at https://github.com/plutonium-239/dev.to-frontend-challenge

Journey

Theming/CSS

I wanted to go with a night sky theme because the Winter Solstice causes the Northern Hemisphere to experience the shortest day of the year. So, I remembered our old friend particles.js. Except now it has transformed into tsParticles with a bunch of memory leak fixes, optimizations, and a rewrite in typescript. This forms the background of the page. I configured it to not be distracting while also looking lively and aesthetically pleasing. Getting this setup was a pain that I did not expect. The latest version has a tsparticles.bundle.js which is supposed to be everything you need and exports globals so that you can get started in one line, but that was not the case. I tried to manually call it's setup while using the tsparticles.engine.js to no avail. This suffers from a lack of useful documentation. I also tried the slim version which had one example usage but it did not work. I tried just replacing the version with an older one (since what I needed was mostly basic behaviour and not their newer features) and struck gold with 1.43.1. You would expect following the instructions in the readme would get you live, but this was not true here.

Choosing the color scheme was kind of a funny coincidence. I had seen a screenshot of a tumblr post/meme and really liked the colors in it. I literally searched for a higher res image through Google Lens and extracted its colours. This provided me with 3 base colours (surface, primary, active). For the other colours, I wanted one of them to be a red-pink shade and one to be greenish/turquoise. I chose some colors in this range and matched the shade so that it was consistent with the current colour palette. I learnt about great tools like Colormind to try alternate colour palettes.

My submission for the Frontend Challenge (Dec

As for typography, I have known about the Readex Pro font for quite some time now, and I really like it. It serves well both as a display font for headings and also as a base font for normal text. I did try a couple of others (Noto, Raleway) but ended up going with Readex Pro. I had also thought about going with a monospaced font for all the text, but the content on this page just wasn't compatible with that styling.

Next, for the scroll-driven animations! I have wanted to use these in real websites for some time now, and I included them in the TOC and the heading. There were some issues with Firefox (still) not supporting animation-range (and scroll-driven animations themselves being disabled by default behind a flag1), so I had to implement a hack-ish fix (but you still need to enable the flag).

Content/HTML (through JS)/CSS

Coming to the content, I did this in two ways:

  1. Adding highlights to text through JS - essentially needed to replace innerHTML which feels bad, but not being able to modify HTML is pretty restricting. I've also added an image to the introduction using JS by inserting an element. I did this because I wanted to add a little fade-in effect to it. Initially, I had done this through a CSS background on the section's ::after, but getting the fade to be consistent (i.e. the top edge of the image to not be visibly sharp) across various desktop sizes and mobile turned out to be impossible. So, I had to add a new element in the section, and then style the ::after pseudo element constrained to the image itself - which works very well.
  2. Adding images to celebrations through CSS - For each of the four celebrations, I found fitting pictures through various sources (credited) and added these through pseudo elements. I gave them a nice parallax style and also added a show full-image on hover interaction. Because of the diversity of images, I did my best to find high-resolution ones and then resized them to have a uniform width of 800px using ImageMagick. I implemented this in a clever way making use of the .celebration class to define the framework and using CSS variables for each particular celebration to define the image URL (and the credits text).

For the traditions page, I changed out the list markers to (and learned how to use) a custom @counter-style - this is a pretty nifty feature!

Interaction: I added a scroll indicator in the TOC using the IntersectionObserver API. This was fairly straightforward: check for intersection, set a class and that's it!

There is also a hover effect on the celebration list items, which reveal the whole respective image. I did this through CSS by setting an image as the content of ::after and making it visible on hover.

?I might have also added a cool little secret at the end of the page?

This makes use of the Canvas API and a scroll listener. It looks pretty cool, but I wasn't 100% sure if it fit in with the rest of the styling.


Conclusion

I am not a UI designer/webdev by profession. In fact, I am an ML researcher. But I have designed apps/websites, and I like being creative!

So, when I saw the challenge post, I thought it was interesting but I didn't think I was going to take it too seriously. However, I coincidentally saw the screenshot talked about above, and a website using an old particles.js effect, and those two must've clicked at some point. Call that a Christmas miracle! ?

I don't really have any future steps in mind, I feel like I did what I planned on doing and more.

Going over some others' submissions, I think it was not that clear that the HTML could not be edited directly. I have followed this set rule and only added a script tag and link tags for CSS - without editing any of the actual markup content.

The code is available under the MIT License.


  1. For anyone on firefox/-based browsers (e.g. Zen), turn on layout.css.scroll-driven-animations.enabled in about:config ↩

The above is the detailed content of My submission for the Frontend Challenge (Dec&#. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Vue 3 Vue 3 Apr 02, 2025 pm 06:32 PM

It's out! Congrats to the Vue team for getting it done, I know it was a massive effort and a long time coming. All new docs, as well.

Can you get valid CSS property values from the browser? Can you get valid CSS property values from the browser? Apr 02, 2025 pm 06:17 PM

I had someone write in with this very legit question. Lea just blogged about how you can get valid CSS properties themselves from the browser. That's like this.

A bit on ci/cd A bit on ci/cd Apr 02, 2025 pm 06:21 PM

I'd say "website" fits better than "mobile app" but I like this framing from Max Lynch:

Stacked Cards with Sticky Positioning and a Dash of Sass Stacked Cards with Sticky Positioning and a Dash of Sass Apr 03, 2025 am 10:30 AM

The other day, I spotted this particularly lovely bit from Corey Ginnivan’s website where a collection of cards stack on top of one another as you scroll.

Using Markdown and Localization in the WordPress Block Editor Using Markdown and Localization in the WordPress Block Editor Apr 02, 2025 am 04:27 AM

If we need to show documentation to the user directly in the WordPress editor, what is the best way to do it?

Comparing Browsers for Responsive Design Comparing Browsers for Responsive Design Apr 02, 2025 pm 06:25 PM

There are a number of these desktop apps where the goal is showing your site at different dimensions all at the same time. So you can, for example, be writing

How to Use CSS Grid for Sticky Headers and Footers How to Use CSS Grid for Sticky Headers and Footers Apr 02, 2025 pm 06:29 PM

CSS Grid is a collection of properties designed to make layout easier than it’s ever been. Like anything, there's a bit of a learning curve, but Grid is

Why are the purple slashed areas in the Flex layout mistakenly considered 'overflow space'? Why are the purple slashed areas in the Flex layout mistakenly considered 'overflow space'? Apr 05, 2025 pm 05:51 PM

Questions about purple slash areas in Flex layouts When using Flex layouts, you may encounter some confusing phenomena, such as in the developer tools (d...

See all articles