+ Start a Discussion

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}"/>


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/



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