I'm trying to insert a vf page within another vf page. Apex:include works, but it makes the related lists stretch horizontally. I don't know why this is, but I'd rather the related lists didn't change.

I tried using apex:iframe instead, but that presented it's own problems, although it didn't cause the lists to stretch.

Excerpt from my vf page:

 <apex:include pageName="{!$page.iv__InsideView_Account_Connector}"/>




           <apex:relatedList list="Contacts"/>


What a related list looks like with apex:include:

enter image description here

What it should like:

enter image description here

  • 1
    if you specify height and weight, is that same issue is occuring? Jun 12, 2017 at 15:28
  • 1
    sorry, for my typo, its width Jun 13, 2017 at 1:59
  • 1
    the related list stretches horizontally? I could not see the list stretching more than it should be. It looks something like this, infallibletechie.com/2013/08/what-is-related-list.html
    – Saranya
    Jun 15, 2017 at 12:03
  • 2
    I see </apex:pageBlockSection> what are the attributes for <apex:pageBlockSection> did you specified the col attribute? Jun 15, 2017 at 15:19
  • 1
    The included page will be rendered as a div and the related list will also be rendered as div in html, Normally the following div take the entire width of the previous div. You need to place your related list inside a div and set the width and text alignment. In the second image, I think you have the sidebar and showheader attributes set to true. the blank space on the left side is for the sidebar.
    – Saranya
    Jun 16, 2017 at 5:56

1 Answer 1


Try placing the relatedlist inside a div and setting style and width property.

<div style="width:70%;margin-left:80px">
     <apex:relatedList list="Contacts"/>
  • That sorts the width issue I asked about, but do you have any idea why the related list is still positioned in the blue area, as opposed to the white area? Trying to move it up just results in the blue space growing.
    – user34868
    Jun 16, 2017 at 10:10
  • 1
    Try changing the style to "width:70%;margin-left:80px;border-left-color: #ffffff" . It might help.
    – Saranya
    Jun 16, 2017 at 10:22
  • No go, I'm afraid. Also tried background-colour.
    – user34868
    Jun 16, 2017 at 10:31
  • I am not sure why it did not work. I could not reproduce this behavior either, try border-color instead. also try something like this " <table> <tr width="100%" ><td width="30%" style="background-color:white"> &nbsp;</td> <td width="70%" > <apex:relatedList list="Contacts" /> </td></tr> </table>"
    – Saranya
    Jun 16, 2017 at 11:21

You must log in to answer this question.