ich eine Warnung in einem Textfeld mit dem folgenden Code positionierte:Positionierung ein Warnfeld in einem Textfeld
CSS:
#alertBox {
width: 30%;
height: 12%;
margin: auto;
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
padding: 40px;
background-color: #0075bf;
color: white;
text-align: center;
font-size: 20px;
}
#template {
font-family: Lato Regular;
width: 70%;
margin: auto;
margin-top: 10%;
}
/* Medium,Small and Extra Small Devices */
@media (max-width: 992px) {
#alertBox {
width: 100%;
margin-left: 3%;
margin-right: 10%;
}
#template {
width: 100%;
margin-top: 5%;
}
}
HTML:
<div class="container">
<article id="template">
<form role="form">
<fieldset class="form-group">
<h5 for="myOffer">Mon offre</h5>
<div id="alertBox" class="alert alert-info">
<a href="#" class="close" data-dismiss="alert" aria-label="close">×</a> Merci de compléter votre offre avant de cliquer sur envoyer
</div>
<textarea class="form-control" rows=" 13 " id="myOffer "></textarea>
</fieldset>
</form>
</article>
</div>
Allerdings, wenn ich die Größe Das Formular, die Alertbox positioniert sich nicht richtig innerhalb des Textfelds.
Hier ist, wie die endgültigen Ergebnisse aussehen sollte:
bitte irgendwelche Vorschläge?
was willst du. Lass es klar wissen und entferne 'width: 100%' von 'media query', dann wird' margin' in 'text area' funktionieren, weil du' width: 100 %' gibst, deshalb ist margin nutzlos. –
Wenn ich die Größe des Formulars (<992px) ändere, möchte ich, dass das Dialogfeld die volle Breite des Textfelds annimmt, wie in dem Bild, das ich hinzugefügt habe. Entfernen 'Breite: 100%' hilft auch nicht. Das Dialogfeld wird über dem Textfeld für kleinere Bildschirmgröße angezeigt. – Veela
so ist es einfach geben Sie "Position: relativ" zu 'Form-Gruppe' Klasse und entfernen Sie' Rand' von 'Media-Abfrage' verwenden Sie nur' width: 100% ' –