0

enter image description here

As you can see, I got it right when the list inside my block has only one row, but it's wrong when the list is bigger.

Since I can't select only those inputs followed by errors (see here), my current solution is a negative margin-top:

.errorlist {
    display: inline-block;
    position: relative;
    margin-left: 1em;
    margin-top: -1em;
    max-width: 30em;
    min-width: 10em;
    border-radius: 4px;
}
/* Arrow: */
.errorlist:before {
    content: "";
    width: 0;
    height: 0;
    position: absolute;
    left: 10px;
    bottom: 100%;
    border-color: transparent transparent rgb(205, 10, 10) transparent;
    border-style: solid;
    border-width: 10px;
}
.errorlist li {
    margin: 0;
    padding: 0.5em;
}

Relevant HTML:

<div class="required">
     <p>
         <label for="id_username">Nombre de usuario:</label> 
         <input type="text" name="username" maxlength="30" id="id_username">
     </p>
     <ul class="errorlist ui-state-error">
         <li>Este campo es obligatorio.</li>
         <li>Este campo es obligatorio.</li>
     </ul>
</div>

EDIT: I've noticed that only the 2nd <li> is moving the block. I can add as many as I want and the block doesn't slide updwards any more.

Community
  • 1
  • 1
Adrián
  • 6,135
  • 1
  • 27
  • 49
  • @Keith yes, it does, but it makes the
      block slide a bit upwards (the first input)
    – Adrián Jul 19 '13 at 17:12
  • not sure if this is the case, but probably because of the style
  • has a padding of .5 so everytime you input a
  • line it will bump up the list a little.
  • – Keith Jul 19 '13 at 17:17
  • if removing the whitespace or the html5 version doesnot works, just use an auto height div with desired padding to display your message. – Madeyedexter Jul 19 '13 at 17:22