仅当Webpart区域中包含Webpart时,如何在div中显示边框>

时间:2020-03-11 15:06:49

标签: sharepoint-2013

我有一个包裹在div中的webpart,该div上应用了边框(class =“ wpz-1”)。无论webpart区域中是否包含webpart,边框都会显示在页面上。仅当webpart区域中包含webpart时,才如何显示边框?

<div class="wpz-1">
    <div data-name="WebPartZone">
        <!--CS: Web Part-->
        <!--SPM:<%@Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"%>-->
        <div xmlns:ie="ie">
            <!--MS:<WebPartPages:WebPartZone runat="server" AllowPersonalization="false" ID="x8600600cbb2046468f9615155e5fd921" FrameType="TitleBarOnly" Orientation="Vertical" >-->
                <!--MS:<ZoneTemplate>-->
                    <!--DC: - Web Part  -->
                <!--ME:</ZoneTemplate>-->
            <!--ME:</WebPartPages:WebPartZone>-->
        </div>
        <!--CE: Web Part-->
    </div>
</div>

1 个答案:

答案 0 :(得分:0)

您可以尝试根据区域的子元素来更改div属性(如果在webpart区域中没有webpart,则根据我的测试,该属性将不会显示,因此请检查webpart区域以确认{{1内是否有webpart) }}。

仅演示:

<div customAttr="customAttr"
相关问题