0

I'd like to center all of the text bodies (or content body before "read more") of all posts (in single.php) at once with simple (or advanced) code. How can i do that?

0

There is probably some CSS you can add via Additional CSS (in Theme CUstomization) that you could use. Use the Inspector tool of your browser (F12) to see the CSS 'class' element used in the content. If the class is called 'the_content', then add this to your Additional CSS:

.the_content{text-align:center !important;}

You might need this, if the content is inside 'p' tags:

.the_content p {text-align:center !important;}

Adjust it for what you like (you may not need the !important). In the Inspector, you can add CSS stuff to that element to try things out. There are googles/bings/ducks on how to use the Inspector.

  • this only worked for text content but thumbnails that goes external links are not centered by this css code. – vordinerdo Jun 3 at 9:32
  • The thumbnails (or other elements) may have different CSS classes assigned to them. Use the Inspector to look at the actual image element, then add CSS for that element to do what you want. For instance, an img element inside a p element that is inside a the_content element may need '.the_content p img' CSS. The Inspector is your friend here. – Rick Hellewell Jun 3 at 16:44
  • but there are a lot of thumbs, i need to center them at once – vordinerdo Jun 4 at 6:02
  • Then you look for a common class name used in all thumb pix. Use the Inspector (F12) to find them, or look at a page source code. If there isn't a common class used, then you may need to make a child theme and/or a custom template that includes a class name that is applied to all thumbs. – Rick Hellewell Jun 4 at 16:56
  • how to exclude pages from this? – vordinerdo Jun 14 at 8:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.