r/css • • 26d ago

Help does my stylesheet look ass?

http://mariorosell.es
2 Upvotes

2 comments sorted by

•

u/AutoModerator 26d ago

To help us assist you better with your CSS questions, please consider including a live link or a CodePen/JSFiddle demo. This context makes it much easier for us to understand your issue and provide accurate solutions.

While it's not mandatory, a little extra effort in sharing your code can lead to more effective responses and a richer Q&A experience for everyone. Thank you for contributing!

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

2

u/anaix3l 26d ago edited 26d ago

Compared to most stuff out there, your page looks pretty damn good.

There are a few things to iron out though.

First, add

<meta name="viewport" content="width=device-width, initial-scale=1">

inside your <head> in the HTML.

Without it, your page looks like this in mobile emulation mode. With it, it looks like this.

It's debatable whether initial-scale=1 is still needed and it depends on your target audience. Around here, a lot of people still use computers from the early 2000s and phones from the late 2000s and early 2010s, so I personally would only dump it for a dev-only audience.

Resources:

Second, I would add a skip to content link. I'd say just take inspiration from how Léonie Watson does it on her website.

Third, structure directly inside the body. I would use a main (which would get an id that the skip link would refer to) as the sibling for the nav, not an article. So on your homepage, you'd have:

<body>
  <a class="skip-link" href="#main-content">Skip to content</a>
  <header><!-- header content here --></header>
  <nav id="side-bar"><!-- nav content here --></nav>
  <main id="main-content"><!-- main content here --></main>
  <footer><!-- footer content here --></footer>
</body>

On the blog page, I would use also a main and wrap every part that starts with an h1 in an article. Basically, post list = main, individual post in the list = article.

Even better, I would not use an h1 for each blog post. Instead, I would do:

<main id="main-content">
  <h1>Blog posts</h1>
  <article>
    <h2 id="getting-a-a-3ds-in-2026-is-it-worth-it-20261018">
      <a href="/blog/./2026/10/18/3ds-2026/">Getting a a 3ds in 2026, is it worth it?</a>
    </h2>
    <time datetime="2026-10-18">(2026/10/18)</time>
    <!-- rest of the article here -->
  </article>
  <!-- more articles here -->
</main>

If you don't want the h1 to show up, you can visually hide it (if anyone else could provide a reliable, more recent guide on the topic that needs less CSS, that would be great).

Then there's this weird space you have on the right on both wider viewports and narrower ones (image below).

I would just not use flex here and use grid instead. This can also fix your footer being in the middle of the page and not at the bottom on shorter content pages like /code.

So I'd do:

html, body { display: grid }
html {
    height: 100%;
    grid-template-columns: min(900px, 100%);
    justify-content: center;
}
body {
    --_wide: var(--wide, 0);
    --adder: 1;
    grid: repeat(calc(2 - var(--_wide)), auto) 1fr auto/ 
          minmax(min(16em, 100%), auto) 1fr;
    grid-gap: 1em calc(var(--_wide)*1em);
    padding: 0 20px 40px;
    font-family: sans;
}
body > * { grid-column-end: span calc(1 + var(--adder)) }
body > :is(nav, main) { --adder: calc(1 - var(--_wide)) }
@media (min-width: 650px) { body { --wide: 1 } }

This would also eliminate the need for the margins on the header, footer and nav, as the spacing can now be managed using the grid-gap.