function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
di_zoudi_zou 

How do I get my Apex Page Block to align to the top?

I have a Apex Page that looks like this:

    <apex:page showHeader="false" sidebar="false" standardController="News__c">
        <apex:stylesheet value="{!URLFOR($Resource.background_template)}"/>
        <apex:pageBlock title="News">
            <apex:outputField value="{!News__c.News__c}"/>
        </apex:pageBlock>
    </apex:page>

 

When it renders to the page, it looks like this:

 

How would I get it so that the News Block is lined up at the top with the stuff on the left? I want it to look like this:

 

Anup JadhavAnup Jadhav

try applying css styling to the element.

 

<apex:pageBlock styleClass="pBlock" title="News">

 Then add a css like this:

 

.pBlock {
 position: relative;
 top: 1em;
}

If relative doesn't work, then try "absolute" and tweak the values as required. You can find more info about css positions here: http://htmldog.com/reference/cssproperties/position/

 

sparun1607sparun1607

FYI and A there is no styleClass attribute in <apex:pageBlock> if have the attribute there will be error 

Error: Unsupported attribute styleclass in <apex:pageBlock> 

 

Could i know any other way to change the styles