Okay, I’m racking my brain over this one… I’m porting the Hitchens theme and can’t get the article page to match even though I’ve looked over the HTML and CSS code numerous times. It only seems to be partially applying on my test post, even though the styling matches between both mine and the official theme.
What doesn’t make sense to me is the CSS for both targets the same .post class, yet it still has visual differences. Anyone have an idea what I’m doing wrong or missing?
Well, either the HTML, CSS, or both differ in some way between your implementation and the original. Not that helpful, I’ll admit. But without access to your test page and the one you’re comparing to, it’s hard to help out.
Okay, so those two pages and their HTML and CSS are pretty different from each other.
Let’s take a concrete example, the page’s heading. The text size of the heading is more prominent in your implementation. That’s because the CSS that applies to the original theme won’t get applied to your version, as the HTML differs.
The CSS rules above will only apply to h1 elements that are direct children of elements with the post class. The relevant HTML looks like this:
<article class="post h-entry" itemscope="" itemtype="http://schema.org/BlogPosting" id="main" role="article" aria-label="Content">
<div class="divided">
<h1 class="post-title p-name" itemprop="name headline">This is a test title</h1>
<div class="read-time">Reading time: 1 minute</div>
</div>
/*[…]*/
</article>
Here, the <h1> element does not reside directly under <article>, and thus the CSS rules won’t apply. Instead, you either have to move the <h1> element up one level or change the CSS selector to .post h1.
Gotcha, I’m not knowledgeable with SASS to know there were differences. I believe the current version of Hugo in Micro.blog doesn’t yet support SASS processing, so that would explain why it was broken. I’m not sure if there are any other parts in the CSS that would cause an issue, but at least I have something to look into if I notice glitches again.