質問

I have a css to hide list search box on document libraries. It's in the SiteAssets library.

I can edit a document library view and add Content Editor webpart and add css reference and able to hide.

However, I added following code to masterterpage after core.css but it doesn't fire. Any idea why?

<SharePoint:CssRegistration name="<% $SPUrl:~SiteCollection/SiteAssets/hideSearchBox.css%>" runat="server"  After="corev15.css" />

The css is 

<style>
.ms-inlinesearch-divbaseline{ display: none !important;}
</style>
役に立ちましたか?

解決

You need to enable publishing features on the site collection (SP_Site) and on the web (SP_Web) and set the alternate CSS URL to your css-file.

  1. Find "Site Collection Features" setting and enable all features with name "publishing" in it.
  2. Find "Manage Site Features" setting and enable all feature with name "publishing" in it.
  3. Find "Master Page" setting link under "Look and Feel".
  4. Click "Alternate CSS URL". This is where you apply your own CSS file.
  5. Upload a CSS file to any document library. Ideally to "Style Library".
  6. Go to step 4 and choose your uploaded CSS file.

Source: Most upvoted answer to the question "CSS and master page - Sharepoint online - Office 365"

他のヒント

If you are trying to add in the HTML page (ex: seattle.html) then use the below code

<!--MS:
<style type="text/css">-->
  .ms-inlinesearch-divbaseline{ display: none !important;}
<!--ME: </style>-->
ライセンス: CC-BY-SA帰属
所属していません sharepoint.stackexchange
scroll top