Am creating a simple app for adding dynamically students and teachers.
Am adding div's dynamically on click.
I have added the class "userListUnit" to that div.
This is the JS:
SchoolAdmission.prototype.display = function(nameButton) {
var print = document.createElement("div");
print.className = "userListUnit";
print.innerHTML = "Name: " + this.name + ", age:" + this.age + ", depart: " + this.department + "<br><br><br>";
if (nameButton === "addStudent") {
document.getElementById('studentList').appendChild(print);
}
else {
document.getElementById('teacherList').appendChild(print);
}
clearFields();
};
This is the CSS:
.userListUnit{
vertical-align: middle;
border: 1px solid;
text-align: center;
line-height: 10px;
box-shadow: 5px 5px 5px #888888;
margin-bottom: 2em;
}
My Fiddle: http://jsfiddle.net/LPu9x/7/
Try adding a student or a teacher and check the position of the text within the dynamically created div,then you will understand its not vertically center. Any1 got any ideas to clear this out?
Conditions:
1) No position : absolute.
2) Div's created should still come below one after another.
Updated Fiddle Solution : http://jsfiddle.net/LPu9x/8/