On SharePoint 2013, I'm trying to center-align the page title with a Content Editor web part. Sadly it doesn't work. Here's my code:

       text-align: center;

I need help to figure out why it's not working because when I'm adding the code directly to F12 it's working.

  • Are you typing your code directly into the CEWP, or are you linking to a text file that contains your code? – Jammin4CO Aug 13 '19 at 16:25
  • I'm typing directly into the CEWP – user85905 Aug 13 '19 at 17:07
  • You can add !important after your css. – user80093 Aug 14 '19 at 5:52

Try using below code:

.ms-core-pageTitle, .ms-core-pageTitle span a {  
    text-align: center !important;


#pageTitle, #pageTitle a {
    text-align: center !important;

Also try creating HTML file and put this code inside <style type="text/css"></style> and then reference it in CEWP.


How to add HTML file in content editor in SharePoint 2016/2013/Online.

  • I tried typing directly all the codes into the CEWP and it's still not working. Not sure how to do the referencing of the html code as you last mention. – user85905 Aug 13 '19 at 17:17
  • @user85905 Create a text file with .html as the file type. Save it to a library on the site. Then copy the URL to it. Next, edit the CWEP and look in the popup menu on the right for a blank to put the link to the file. It should be at the top. – Jammin4CO Aug 13 '19 at 17:32
  • Ok I will try it this way. – user85905 Aug 13 '19 at 17:41
  • I added the HTML file into my site assets and referenced it to the CEWP but it's still not work. – user85905 Aug 13 '19 at 17:52
  • It is working for me. You must be missing something. Check the link in updated answer. Also try creating '.css' file and referencing that file in HTML. So that you can check if your css file is correctly loaded or not from Sources tab in browser developer tools(console). – Ganesh Sanap Aug 14 '19 at 4:34

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.