gpt4 book ai didi

html - 不一致的 CSS 表显示(使用 SQL 和 PHP)

转载 作者:太空宇宙 更新时间:2023-11-04 12:11:29 25 4
gpt4 key购买 nike

我遇到了一个问题,当我使用 PHP 和 HTML 从数据库中将信息回显到表中时,信息会根据它的加载方式移动。

我的意思是,如果我不断刷新,一切都会与以前不同。我的意思是它是如何显示的,而不是显示的内容。

.tracklist {

}
.tracklist img {
max-width:15%;
max-height:15%;
}
.tracklist td{
width:36%;
display:block;
padding:1%;
text-align:center;
}

#content {
width:98%;
height:73%;
padding-left:1%;
padding-right:1%;
background-color:#d8d8d8;
text-align:center;
}
#contentbox {
border-radius: 15px;
-moz-border-radius: 15px;
-webkit-border-radius: 15px;
text-align:center;
background-color:#999999;
}

<div id="content">
<div id="contentbox">
<br />
<table class="tracklist">
<?php


$i = 0; $trEnd = 0;
while ($row = mysql_fetch_array($result)){
if($i == 0){
echo '<tr>';
}
echo '<td>';
echo $row["genre"]." | ".$row["artist"]." | ".$row["name"];
echo '<br />';
echo "<img src=".$row["image"].' />';
echo '</td>';
if($i == 2){
$i = 0; $trEnd = 1;
}else{
$trEnd = 0; $i++;
}
if($trEnd == 1) {
echo '</tr>';
}
}
if($trEnd == 0) echo '</tr>';

?>
</table>
</div>
</div>

来自数据库的数据在标题中被调用只是为了让人们知道它被调用了。

最佳答案

通过放置 width:100%; 来解决这个问题在它继承高度的类中。

现在似乎修复了它。

关于html - 不一致的 CSS 表显示(使用 SQL 和 PHP),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29014100/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com