Blog styling css
-
Hello,
Can someone please help me with my blog post styling.
Id like to be able to set the paragraph font and size via css across blog pages only.
Id also like to do the same for headings.
Im guessing id need to target something like .post?
Would this then apply to all blog posts only?
My site is http://www.thetenthyard.co.uk in case you need to see it (blog is currently in a mess, hence why i want to get all post looking the same via some css)
Many thanks
-
@shaggyshoogz – you have alot unnecessary inline styling on each paragraph eg
<p style=”text-align: justify;”><span style=”font-size: 12pt;”>The main reason blah blah</span></p>
Anyway
.single-post .post p { font-family: helvetica, arial, sans-serif; font-size: 18pt; }but this won’t work because of the inline style ‘font-size: 12pt’ so you need to force it
.single-post .post p { font-family: helvetica, arial, sans-serif; font-size: 18pt !important; }Your post title is actually hidden so if this is the one you want to edit then use this
.single .entry-title, .page-title, .page-title { display: block; font-family: helvetica, arial, sans-serif; font-size: 20pt; }but if you are referring to the h3 in the body text the use…
.single-post .post h3, .single-post .post h3 span { font-family: helvetica, arial, sans-serif; font-size: 30pt !important; }Notice this has to be forced as well due to the inline styling
Hi Salsaturation, thanks for the response, will be giving that a try at the weekend!
In regards to the additional inline styling, im not sure why that is there, I just type my articles in the visual text editor, im guessing thats what generates it?
is there a downside to having the extra inline styling?
Thanks
It makes your pages unnecessarily bigger than they should be… might have a speed impact if you have a lot of blog post / pages
Thanks for the help, @salsaturation!
@shaggyshoogz – in addition to what salsaturation mentioned, inline styling makes it difficult to override formatting with custom CSS. As you can see above, salsaturation was forced to use many instances of
!important, which is generally bad practice, and isn’t normally needed, as it can cause big headaches down the road if you then try to make additional CSS changes.I also wanted to mention that I’d suggest using a unit other than
pt, which is not commonly used on the web, but more of a print standard. I would suggestpx(pixels) oreminstead.The inline styling was probably added if you used the justify or size buttons in the toolbar. Generally if you’re applying styles to an entire post or to the whole site, it’s much better to use custom CSS, since you can do it in one place rather than having to repeat the formatting. It’s also easier to change down the road via the custom CSS panel in the Customizer.
Just let me know if you have any other questions!
-
This reply was modified 8 years, 11 months ago by
Kathryn Presner. Reason: typo
That makes a lot of sense, thanks!
I shall have to get used to not using the toolbar from now on.
and eventually remove all the inline styling from my current blog posts.
Thanks
My pleasure! Using the formatting toolbar is OK for a small adjustment here and there, but for formatting that you need to repeat over and over, custom CSS is usually better.
I’ll mark this thread as resolved but feel free to start a new one if you need help with anything else.
Ok so im going to go through all my blog posts and try to remove the inline styling, but before i do that id just like to make sure I have this correct…
I have used the CSS kindly provided by Salsaturation above and put it in the custom CSS box. I have targeted P and H3, as thats all I use.
Then, when writing a new post, in text view (not toolbar) I would write something like…
<h3> This is the title of my blog <h3>
<p> This is the content of my post <p>
Am i understanding it right or barking up the wrong tree completely?
Thanks
Close!
<h3> This is the title of my blog <h3>The closing tag needs to look like
</h3>– note the slash before the “h.”<p> This is the content of my post <p>You don’t need to add paragraph tags in the editor – WordPress adds those automatically after you save the post.
So you can just write:
This is my first interesting paragraph. This is another very fascinating paragraph.And WordPress will add the paragraph tags for you, you just won’t see them in the editor.
Once you have one post where the inline styles have been removed, feel free to pop a link to it here. We’ll be able to simplify the CSS that was given to you earlier.
Hello,
Ive edited a post with the help you gave me, seems pretty simple now so im glad it was pointed out, my post looks more professional doing it the way you have suggested and this will save me a ton of time in the future.
so the one I have edited is:
http://thetenthyard.co.uk/exercises-probably-avoid/
criticism more than welcome!
Thanks
Cool! @shaggyshoogz one thing I noticed is that you’re missing the space that’s usually displayed below paragraphs. That’s because you have line breaks instead of paragraph breaks between them.
For example, for this section:
if you flip to the HTML/Text editor, you’ll probably see something like:
There are some exercises that should be the basis of all of your workouts, on the flip side there are some that shouldn’t see the light of day if you value your joints. As the fitness industry has progressed from the golden era it has become apparent that certain movements are more likely to cause long term damage than others, we're not talking about poorly executed movements, that's an entirely separate article! We're interested in the ones that even when done with good form will potentially lead to injuries and problems later on in life.Try adding a blank line between them so it looks like this in the editor:
There are some exercises that should be the basis of all of your workouts, on the flip side there are some that shouldn’t see the light of day if you value your joints. As the fitness industry has progressed from the golden era it has become apparent that certain movements are more likely to cause long term damage than others, we're not talking about poorly executed movements, that's an entirely separate article! We're interested in the ones that even when done with good form will potentially lead to injuries and problems later on in life.Do that between each set of paragraphs. Let me know how it goes!
Noted and changed!
Thanks so much for your help, massive appreciation, cant thank you enough!
You’re very welcome!
-
This reply was modified 8 years, 11 months ago by
The topic ‘Blog styling css’ is closed to new replies.

