0

I would like to center the error message displayed via <apex:PageMessages> however it is not responding to div/css tags such as div align="center" or text-align: center; - does anyone know how we can center <apex:pageMessages>?

1 Answer 1

2

The apex:pageMessages element doesn't appear to want to appear inside a div (it gets "kicked out" into its own area), so some trickery is required.

The only reasonable solution I've found so far is to modify the inner CSS rules:

<style>
.message {
    text-align: center;
}
.messageTable {
    width: 100%;
}
</style>

The first aligns the text within the "message" area, the second makes the table have a 100% width (by default, it's "auto").

1
  • Thanks, I found that margin-left also worked
    – SpicyPat
    Commented Apr 10, 2021 at 22:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .