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
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").