none
sharepoint page ignore css RRS feed

  • Question

  • Hello,

    I want to learn a little about page editing. I created a test wiki page in sharepoint (MySP/PWA/wikitest).

    Checked youtube, read about it. So as they said i created a .css file with a very simple code like:

    body{

    background-image:url('../PublishingImages/CatWallpaper.jpg')

    }

    Created a content editor on the page and edited its html and added the link to the .css.

    <link href="/PWA/SiteAssets/myfirst.css" rel="stylesheet" type="text/css"/>

    And nothing happened. Nothing changed.

    I even tried to add this link to the v4.master. Nothing.

    What am i missing here?


    I Hate Mondays

    Thursday, April 6, 2017 1:06 PM

Answers

  • Some points to check,

    • Make sure that you have provided the correct URL at background-image and a <link href="/PWA/SiteAssets/myfirst.css" rel="stylesheet" type="text/css"/>
    • Make sure you edit the correct master page.
    • Make sure you added link tag within head tag.
    • Make sure you the master page has been published as a major version.

    In case you did all the above steps and the issue still persists,  try to use the below CSS and check the result (Unfortunately, I don't have SP 2010 right now to try it but it should work!!)

    <style type="text/css">
    .ms-bodyareaframe {
                    background-color: <color you like>;
    }
    </style>



    Monday, April 10, 2017 12:44 PM

All replies

  • Hi Lokids- TGINM! ;)

    The master page is overriding your css. You'd be best to make a copy of the master and add your code directly. However, first try to use !important; for your background. That should override the master.

    https://www.smashingmagazine.com/2010/11/the-important-css-declaration-how-and-when-to-use-it/


    cameron rautmann

    • Proposed as answer by romeo donca Friday, April 7, 2017 8:58 AM
    • Unproposed as answer by Lokids Friday, April 7, 2017 10:21 AM
    Thursday, April 6, 2017 3:37 PM
  • The !important is not working. :(

    So i added this to the v4.master file directly under the </head> line.

    <style type=”text/css”>

    BODY

    {

    background-image:url('../../PublishingImages/CatWallpaper.jpg') !important;

    background-repeat:no-repeat;

    BACKGROUND-COLOR: transparent !important;

    }

     

    .s4-ca {

    BACKGROUND-COLOR: transparent !important;

    }

    .ms-alternating,.ms-gb,.ms-alternatingstrong {

    background-color: transparent !important;

    }

    .ms-WPHeader {

    background-color: transparent !important;

    }
    </style>

    And still not working.


    I Hate Mondays

    Friday, April 7, 2017 8:27 AM
  • Needs to be inside the <head></head> area. Also make sure you remove any background css if there is any.

    cameron rautmann

    Friday, April 7, 2017 12:23 PM
  • Hi Lokids,

    Does the CSS work now?

    If you think the suggestion provided by croute1 is helpful, please mark it as an answer. It will help others in the forum.

    Best Regards,

    Linda Zhang


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Monday, April 10, 2017 10:21 AM
    Moderator
  • Please try to add "important" keyword:

    body{
    
    background-image:url('../PublishingImages/CatWallpaper.jpg') !important;
    
    }


    Thanks, Amit Kumar, LinkedIn Profile ** My Blog
    Please click "Mark As Answer" if this post solves your problem or "Vote As Helpful" if it was useful

    Monday, April 10, 2017 11:28 AM
  • Some points to check,

    • Make sure that you have provided the correct URL at background-image and a <link href="/PWA/SiteAssets/myfirst.css" rel="stylesheet" type="text/css"/>
    • Make sure you edit the correct master page.
    • Make sure you added link tag within head tag.
    • Make sure you the master page has been published as a major version.

    In case you did all the above steps and the issue still persists,  try to use the below CSS and check the result (Unfortunately, I don't have SP 2010 right now to try it but it should work!!)

    <style type="text/css">
    .ms-bodyareaframe {
                    background-color: <color you like>;
    }
    </style>



    Monday, April 10, 2017 12:44 PM
  • Sorry i was "off" for the weekend.

    But this is not working either.

    What i do:

    Open my http://sharepoint/pwa/wiki webpage in Designer.

    I select the masterpages menu and then the v4.master. Open it for edig.

    Copy the style you wrote just BEFORE the </head>

    Save.

    But nothing changed.


    I Hate Mondays

    Tuesday, April 11, 2017 9:34 AM
  • Did you follow M.Qassas' steps?

    cameron rautmann

    Tuesday, April 11, 2017 12:09 PM