Hi David,
Thank you so much for getting back to me. The CSS you provided works wonderfully except the .nav-next:before is not aligned to the right and in mobile view .nav-previous:before is forced on to two lines.
I also have no idea how you worked your magic to add the previous & next post URL’s to both .nav-previous:before and .nav-next!
I had almost got it too after I came up with the marvellous idea of editing my CSS in WordPress’s Additional CSS editor so that I could see it take effect in real time.
Why I didn’t think of this sooner I have no idea… – I even figured out how to use text-overflow: ellipsis; too haha ??
Anyway, this is where I had gotten up to:
/* Add space between tags and prev & next links */
#nav-below {
margin-top: 30px;
}
/* Make prev & next in-line */
.post-navigation {
display: flex;
}
/* Move prev post link to left */
.nav-next {
margin-left: auto;
}
/* Move next post link to right */
.nav-previous {
margin-right: auto;
}
/* Add prev article heading */
.post-navigation .nav-previous:before {
content: "Previous Article";
display: block;
font-size: 14px;
font-weight: bold;
text-transform: uppercase;
text-align: left;
}
/* Add next article heading */
.post-navigation .nav-next:before {
content: "Next Article";
display: block;
font-size: 14px;
font-weight: bold;
text-transform: uppercase;
text-align: right;
}
/* Truncate prev & next post title on desktop */
.nav-next, .nav-previous {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
max-width: 45%;
}
/* Media Query for Mobile Devices */
@media (max-width: 480px) {
/* Truncate prev & next post title on mobile */
.nav-next, .nav-previous {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
max-width: 50%;
}
}
/* Media Query for low resolution Tablets, Ipads */
@media (min-width: 481px) and (max-width: 767px) {
/* Truncate prev & next post title on tablet */
.nav-next, .nav-previous {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
max-width: 40%;
}
}
The only thing I was still scratching my head over was how to move the ‘>‘ from the left hand side of the next post link to the right hand side like so:
NEXT ARTICLE
Next post title >
Could you advise how to do this last bit as I have been scratching my head over it for a very looooong time now.
Don’t worry, I will be using your far superior CSS, but I’d still like to understand the above solution.