Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/91.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
为什么php插入的div重叠?_Php_Html_Css - Fatal编程技术网

为什么php插入的div重叠?

为什么php插入的div重叠?,php,html,css,Php,Html,Css,我得到了这个html代码 <html> <head> <meta charset="utf-8"> <title>Dashboard</title> <link rel="stylesheet" href="styles.css"> </head> <body> <?php include 'functions.php'; $logs = getUnsuccessfulB

我得到了这个html代码

<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>

为什么插入的元素是彩色的,但没有按照我希望的方式对齐?它们都在同一位置,即使我更改了
边距

您给出的所有.errorlog div
位置:绝对,这将绝对地将它们都放置在彼此的顶部。

删除
位置:绝对来自
.errorlog
。谢谢,就这样:)谢谢。就这样:)
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;
}