Site logo

Archived topic

changing post margins without effecting page margins

3 replies · Started by Streater on July 15, 2021

Viewing posts 1–4 of 4

How do I change the margins just for posts?

I tried these options below:


@media (max-width: 769px) {
.entry-content:not(:first-child) {
    margin-top: 10px;
    margin-left: 20px;
    margin-right: 20px;
    padding: 0px;
}
}
AND
@media (max-width: 769px) {
.inside-article{
    margin-top: 10px;
    margin-left: 20px;
    margin-right: 20px;
    padding: 0px;
}
}

YES these do change the margins for pages BUT they also change it for all my pages. I have different margins settings for my pages (I set the default margins to 0px and control the spacing in each div with a universal class)... and these solutions above ADD extra spacing on the side for all my pages which is a huge problem.

Any ideas?

Hi there,

We can add single post page selector to the CSS so it only applies to the single post pages.

Example:

@media (max-width: 769px) {
body.single .inside-article{
    margin-top: 10px;
    margin-left: 20px;
    margin-right: 20px;
    padding: 0px;
}
}

Perfect! Thank you!

Nice one. No problem. :D

This archived topic is closed to new replies.