Reputation: 129
I got this html Code
<html>
<head>
<meta charset="utf-8">
<title>Dashboard</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<?php
include 'functions.php';
$logs = getUnsuccessfulBuilds();
for ($i = 0; $i < sizeof($logs); $i++){
echo("<div class='errorlog'>");
echo($logs[$i]['name']);
echo($logs[$i]['id']);
echo("</div>");
}
?>
</body>
</html>
And this css code
body {
background-color: #27373d;
}
.container {
position: relative;
width: 100%;
height: 100%;
}
.errorlog {
display: block;
border-radius: 3px;
width: 10%;
overflow: hidden;
float: left;
background-color: #c6656a;
padding: 20px;
position: absolute;
margin: auto;
vertical-align: middle;
}
Why are the inserted elements colored, but not aligned as I want them to be? They are all at the same position, even if I change margin
.
Upvotes: 0
Views: 213
Reputation: 2528
You have given all of the .errorlog divs position: absolute;
, which will absolutely position them all ontop of each other.
Upvotes: 1