apex:slds tag works in Lightning Experience where as it is not working in Napili Community.This visualforce page is added as action button.
<apex:page standardController="Account">
<apex:slds/>
<apex:pageBlock >
<apex:pageblockSection columns="2">
<apex:outputField value="{!Account.Name}"/>
<apex:outputField value="{!Account.Type}"/>
<apex:outputField value="{!Account.BillingStreet}"/>
<apex:outputField value="{!Account.BillingCity}"/>
<apex:outputField value="{!Account.BillingState}"/>
</apex:pageblockSection>
</apex:pageBlock>
</apex:page>
Best Answer
While it's true that SLDS doesn't support
apex:pageBlock
, what you do see is the global font and spacing changes provided by SLDS.I'm guessing the iFrame used in Lightning Communities doesn't pre-scope the markup for you. Try wrapping it in a
<div class="slds-scope"> [content goes here] </div>
?But if you're not even trying to use SLDS classes, maybe you might want to experiment with a brand-spanking-new feature to style Visualforce pages like Lightning. So you could also try removing
<apex:slds/>
and instead adding the attributelightningStylesheets="true"
to yourapex:pageBlock
. Make sure the Visualforce page has API version set to 41.