Support » Developing with WordPress » Page title to have 2 different colours

  • Hello,
    I’m new to building a website and require help in regards to my page title.
    I know you can remove the page title and create a new one in the body of the page, however I’d prefer to just be able to edit the page title directly.

    The page title is – Why S…Silk?
    and I need the ‘S’ to be blue.
    Can anyone please show me the CSS that need to be entered, along with what I need to insert and where into the coding.

    The below works to add an ‘S’ into the title before the page title, however I need it to be added between two words in the title.
    .page-id-1524 .entry-title:before {
    content: ‘S’;
    color: #123456;
    }

    Thank you kindly

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hello,

    you can change the page title for a particular page in the WordPress admin section.

    please check the below screenshot
    https://prnt.sc/uw0c95

    Using CSS you can do

    .page-id-1524 .entry-title:before {
    content: ‘S’;
    color: #123456;
    position: absolute;
    margin-left:275px;
    }

    Please change the margin-left according to your content.

    Thanks

    Page titles can contain HTML, so you can easily enter the page title as
    Why <span style="color:blue">S</span>…Silk?

    Thread Starter smtced11

    (@smtced11)

    Hi Aims Infosoft & Joy,

    Thank you for your replies,

    I found that neither of your coding worked –
    I have already tried this one it doesn’t change the letter to blue in the page title it just inserts a new letter ‘before’ the page title.

    .page-id-1524 .entry-title:before {
    content: ‘S’;
    color: #123456;
    position: absolute;
    margin-left:275px;
    }

    I tried inserting – Why <span style=”color:blue”>S</span>…Silk?
    into the page CSS as well as the actual customise page title & it didn’t work as well.

    Please if anyone has any suggestions that could help, please advise.

    Thank you kindly

    My solution is for the page title field, which you can’t change in the Customizer. Are you actually talking about the site title? Site title can’t contain HTML since it is used in many places like <title> tag and RSS feed and copyright text and admin pages.
    Also, HTML doesn’t work in CSS. HTML can contain inline CSS, though.

    Thread Starter smtced11

    (@smtced11)

    Hi Joy,

    I understand, so would I go to the backend of the site – through to file manager & input it there?

    Thank you kindly

    No.
    It sounds like you are asking for something that won’t work, but you haven’t clarified if that is what you actually want.
    Page title and site title are two different things. Which did you want to affect?

    Page title is changed on each page, in the editor. It can contain HTML.
    Site title is changed in Settings > General or in the Customizer. It cannot contain HTML, but you can influence the display of it in the header with CSS, or use a custom logo instead of the title in the header. (The site title text will still be used in the other areas it is used, so don’t make it blank.)
    If you need help with the site title in the header, you should ask in your theme’s support forum, since each theme does this differently.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Page title to have 2 different colours’ is closed to new replies.