Menu

Three front-end bugs my build said were fine
📰

Three front-end bugs my build said were fine

DEV Community: css·Ankit Gupta·8 days ago
#PplMn3Tc
#devtocss#devto#dev#height#grid
Reading 0:00
15s threshold

I run a static browser-games site. Every page exists twice: once as prerendered HTML for search engines, and once as a React app for people clicking around. The build is a babel bundle plus a generator script. Here are three bugs that went through that build without a single error and broke the page people actually saw.

1. <img width="700" height="700"> means height: 700px

Every game card has an image with width and height attributes. That is the standard advice: the browser reserves the right space before the image loads, so the layout does not jump.

My CSS made the image fill its card and kept it square:

.grid img , .cards img { width : 100% ; aspect-ratio : 1 / 1 ; object-fit : cover ; display : block ; }

Enter fullscreen mode

Exit fullscreen mode

The cards were about 176 px wide, so I expected 176 × 176.

The browser drew 176 × 700 on every category, tag and collection page.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.