• Resolved savedave

    (@savedave)


    Hi everyone

    Thanks so much to everyone for helping with this.

    I would like to center the page title on some of my pages. I have read various forum posts offering CSS for the style sheet to center all titles, but I really only want to center titles on a few specific pages.

    Is this at all possible? Is there a text editor for titles the same way as there is for content – or a place where I could enter a tag on the title?

    As an example, I would like to center the word commercials here: https://nadaav.com/n/films/commercials/

    But I do not want to center the words Get In Touch here: https://nadaav.com/n/contact/

    Is this possible?

    thanks kindly

    SD

Viewing 7 replies - 1 through 7 (of 7 total)
  • Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    – View your webpage.
    – Right click where applicable.
    – Select ‘View source’.

    – Look for the <body> element.
    – Look at its classes.

    You should be able to find a class that uniquely identifies particular pages.

    Then you can use those classes to apply styles to particular pages.

    Thread Starter savedave

    (@savedave)

    Thanks for your reply.

    On chrome I did ‘inspect element’ but it just tells me:
    <h1 class="entry-title">Commercials & Brand Films</h1>

    If I understand correctly, the class is “entry-title” and it’s not unique to this page. Changing that would, I believe, change all page titles, not just this one.

    Is that correct?

    thanks

    You need to find the page-specific class which is in the body tag – for example on that page:

    <body class="page page-id-8 page-child parent-pageid-6 page-template-default custom-background single-author singular two-column right-sidebar">

    So then you can use that in the CSS:

    .page-id-8 h1.entry-title {
       text-align: center;
    }

    Thread Starter savedave

    (@savedave)

    Oh I see. that is AMAZING! I didnt really understand how to use the inspect element function – still dont really but this is great.

    WPyogi if you come to London I owe you a massive beer for your continued help!

    ??

    Thread Starter savedave

    (@savedave)

    And thank you Andrew too! A pot of earl grey to you.

    square_eyes

    (@square_eyes)

    This was really helpful thanks. Can you tell me if there is an easier way than to list each page separately?

    Say in the same css class statement, having a list of page IDs?

    Sorry I’m new to CSS.

    square_eyes

    (@square_eyes)

    Spoke too soon. I found this over at Stack Overflow.

    Here is what I used:

    /* Custom Page h1 Styling by ID */
    .page-id-50 h1.entry-title, .page-id-51 h1.entry-title {
      text-align: center;
    }

    I only listed two in this example but I assume there is no limit.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[twenty-eleven] is it possible to center specific page titles?’ is closed to new replies.