Hi Leute,
ich probiere gerade ein bisschen mit dem ZF und der Formulargenerierung. Dabei habe ich ein kleines CSS-Problem.
CSS:
PHP-Code:
.form-errors {
width: 400px;
margin: 0 auto;
padding: 10px;
margin: 0;
border: 2px solid red;
color: red;
background-color: white;
}
.form-errors li {
list-style: none;
background-color: white;
}
HTML:
PHP-Code:
<ul class="form-errors">
<li>
<ul class="errors">
<li>Der Benutzername existiert nicht oder das Passwort ist falsch!</li>
</ul>
</li>
</ul>
Die Liste mit der Fehlermeldung wollte ich auf der Seite horizontal zentriert haben, was doch mit margin: 0 auto; passieren sollte.
Aber IE und FF stellen die Liste linksbündig dar. Weiß jemand, warum?
Das Formular selbst wird mit dieser Angabe (margin: 0 auto;) zentriert dargestellt. Hier nochmal die komplette Seite, falls wer Lust hat drüberzuschauen oder zu testen.
PHP-Code:
<?xml version="1.0" ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Test</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<style type="text/css">
/* Zend Form Styling */
.zend_form {
width: 400px;
margin: 5px auto;
padding: 10px;
overflow: auto;
border: 1px solid #d18b47;
background-color: #ffce9e;
}
.zend_form dt {
padding: 0;
clear: both;
width: 150px;
float: left;
text-align: left;
margin: 5px 5px 5px 0;
}
.zend_form dd {
padding: 0;
float: left;
margin: 5px 2px 5px 0;
}
.zend_form p {
padding: 0;
margin: 0;
}
dl.zend_form dd ul.errors {
list-style: none;
padding: 0;
margin: 0;
}
dl.zend_form dd ul.errors li {
float: left;
margin: 0 0.15em;
font-size: 12px;
color: red;
width: 180px;
}
.zend_form input, .zend_form textarea {
margin: 0 0 2px 0;
padding: 0;
}
.zend_form #username, .zend_form #password {
width: 180px;
}
.zend_form #submit {
width: 100px;
border: 1px solid black;
background-color: #d18b47;
color: white;
font-weight: bold;
padding: 2px;
}
.form-errors {
width: 400px;
margin: 0 auto;
padding: 10px;
margin: 0;
border: 2px solid red;
color: red;
background-color: white;
}
.form-errors li {
list-style: none;
background-color: white;
}
</style>
</head>
<body>
<form id="login_form" enctype="application/x-www-form-urlencoded" accept-charset="UTF-8" action="/login" method="post">
<dl class="zend_form">
<dt id="username-label">
<label for="username" class="required">Benutzername</label>
</dt>
<dd id="username-element">
<input type="text" name="username" id="username" value="" />
</dd>
<dt id="password-label">
<label for="password" class="required">Passwort</label>
</dt>
<dd id="password-element">
<input type="password" name="password" id="password" value="" />
</dd>
<dt id="submit-label"> </dt>
<dd id="submit-element">
<input type="submit" name="submit" id="submit" value="Anmelden" />
</dd>
</dl>
</form>
<ul class="form-errors">
<li>
<ul class="errors">
<li>Der Benutzername existiert nicht oder das Passwort ist falsch!</li>
</ul>
</li>
</ul>
</body>
</html>