Question

I have a css file referenced in my site's master page that changes the header margins. However, I only want this CSS to affect headers on Wiki pages. I also want to avoid having to use a special class where I have to go back and edit each of the header tags in my Wiki pages or where I have to manually write each header tag while creating the pages (I'm going to have hundreds of Wiki pages...).

Is there a way in CSS to target tags belonging to a specific page layout or content type? Currently my header margin CSS is effecting all headers on the site, including webpart headers and site navigation.

I am running SharePoint 2013 Foundation with access to SharePoint Designer 2013.

Était-ce utile?

La solution

If you are only looking to affect things within the main content portion of the page (and not the page title bar, quicklaunch, etc.), on wiki pages all the content is in a div with an ID like ctl00_PlaceHolderMain_WikiField.

wiki field area

Knowing that, you could set up your CSS selectors to always start with

div[id$='WikiField']

so that you will only be targeting elements within that div.

Licencié sous: CC-BY-SA avec attribution
Non affilié à sharepoint.stackexchange
scroll top