[英]PHP database results stacked ontop of each other
So my code is 所以我的代码是
while ( $row = mysqli_fetch_assoc($result) ) {
echo '<div class="leaders" style="background-color:#ada30a;">' . $row['playername'];
echo "<br>";
echo $row['points']. '</div>';
}
All results (3 in total) are meant to have their own seperate div box (which they do) However, all of my boxes are stacked ontop of each other (example: http://prntscr.com/i4ygm4 (2 other boxes are stacked underneath this box) I tried adding a margin bottom in css but it just didn't work) 所有结果(总共3个)本应具有自己的单独的div框(但是它们确实如此)。但是,我所有的框都堆叠在彼此的顶部(例如: http : //prntscr.com/i4ygm4 (另两个框是堆叠在此框下方)我尝试在CSS中添加一个边距底部,但它没有用)
The CSS code is: CSS代码为:
.leaders {
width:265px;
height:100px;;
background-color: #ee845b;
margin-left: 900px;
padding:10px;
text-align:right;
position:absolute;
margin-top:40px;
margin-bottom:500px;
color:white;
font-size: 20px;
border:1px solid black ;
padding-top:10px;
}
How do i resolve this issue? 我该如何解决这个问题?
Thank you so much. 非常感谢。 :) :)
this is caused by position absolute change it to position relative and this wont happen. 这是由于位置绝对改变而引起的,这不会发生。
.leaders {
width:265px;
height:100px;;
background-color: #ee845b;
margin-left: 900px;
padding:10px;
text-align:right;
position:relative;
margin-top:40px;
margin-bottom:500px;
color:white;
font-size: 20px;
border:1px solid black ;
padding-top:10px;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.