Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>This is a big question, but I'll try to break it up.</p> <p>First, regarding your first three requirements, you're probably stuck unless you have the luxury of dictating your browser platform. In order to center a box within an arbitrary DIV on most browsers, you have to specify a width for the inner block element. It has to be a block element so that you can make it look like a box (coloring, border). You can get away without a width on browsers that support <code>display: inline-block</code>. If you wanted, you could try hacking around this with some script, setting a width based on how long the inner text is, up to some maximum.</p> <p>Your next three requirements are at odds with each other. If you allow for multiple flashes, some centered and some left-justified, the justification alone requires that each flash be within its own block element so that you can apply the justification style.</p> <p>It isn't obvious, but there is nothing holding to you to the example flash types of <code>notice</code>, <code>warning</code> or <code>error</code>. If you want to distinguish between those that should be centered (short errors) and those that should be left-justified (newbie intros), put them in the flash with different keys. Iterate through your flash, applying the necessary class name to get the desired styling for each key. If you must support more than one error message, then <code>flash[:error]</code> can be an array. I'd write helper methods to facilitate adding messages to the flash, so you have less conditional code in the views.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload