Php 分区';s高度自动调整
我正在使用div的en-css代码,从mysql数据库中获取一些值 它很好用。但是,如果数据库中的值长于1行,则带有div的表看起来不太好 这是我正在使用的代码:Php 分区';s高度自动调整,php,css,html,Php,Css,Html,我正在使用div的en-css代码,从mysql数据库中获取一些值 它很好用。但是,如果数据库中的值长于1行,则带有div的表看起来不太好 这是我正在使用的代码: $result = mysql_query("SELECT * FROM boxen "); while ($row = mysql_fetch_assoc($result)) { echo '<div class="a naam">'; echo '<a href="boxen.p
$result = mysql_query("SELECT * FROM boxen ");
while ($row = mysql_fetch_assoc($result))
{
echo '<div class="a naam">';
echo '<a href="boxen.php?boxid=' . $row['ID'] . '">' . $row['naam'] . '</a>';
echo '</div>';
echo '<div class="a datum">';
echo $row['datum'];
echo '</div>';
echo '<div class="a land">';
echo $row['land'];
echo '</div>';
echo '<div class="a naam">';
echo $row['starter'];
echo '</div>';
}
对于这个例子,我不需要所有的css代码 你想要一张桌子放这类东西 表格并非都是邪恶的,当用于正确类型的数据(表格数据,即表格中最适合的数据类型)时,表格是完全可以接受的 示例代码:
<style type="text/css">
th {
background-color: rgb(77, 160, 255);
margin-left: 4px;
margin-bottom: 4px;
color: rgb(255, 255, 255);
}
table caption {
font-size: 2em;
font-weight: bold;
}
</style>
<table>
<caption>Inoud van de box:</caption>
<thead>
<tr>
<th>Naam product</th>
<th>Omschrijving</th>
<th>Antal</th>
<th>Datum toegevoegd</th>
<th>Naam toevegoer</th>
<th>Datum verwijderd</th>
<th>Naam verwijderd</th>
<th> </th>
<th> </th>
<th>SAMPLE SAMPLE SAMPLE SAMPLE</th>
</tr>
</thead>
</table>
th{
背景色:rgb(77160255);
左边距:4倍;
利润底部:4倍;
颜色:rgb(255、255、255);
}
表格标题{
字号:2em;
字体大小:粗体;
}
Inoud van de box:
Naam产品
OMSCHRIJING
安塔尔
托伊格沃格基准面
纳姆·托维格尔
基准面verwijderd
纳姆·维尔维德德
样品
欢迎使用堆栈溢出!请停止使用古老的mysql.*
函数编写新代码。它们不再得到维护,社区已开始恢复。相反,您应该学习准备好的语句,并使用或。如果你想学习,.Tnx!我知道我需要使用它!我已经找到了一个很好的教程,我将很快开始学习,但我需要先解决这个问题。但我会用你的建议!请向我们展示从您的脚本生成的HTML,以及您在上面使用的CSS代码。我已经编辑了上面的问题。对不起,我的英语不好。有办法吗?我希望你能理解我的问题?我同意!你不需要每个元素都是无表的,它们是完全可以接受的HTML元素,并且结构良好。@LEDfan:没问题。如果我的答案解决了你的问题,请考虑一下点击这个大的绿色记号来接受这个问题。@ LEDfan:你有足够的声誉来接受你所发布的问题的答案。试试看。
/* Algemeen voor header*/
.header {
background-color:#4DA0FF;
float:left;
margin-left:4px;
margin-bottom:4px;
color:white;
}
/* END HEADER*/
/* ALGEMEEN OVERIZCHT*/
/* naam */
.naam{
width:200px;
height:auto;
}
/* naam die het product er uit heeft gehaald*/
.naamVerwijderaar{
width:210px;
height:auto;
}
/* datum */
.datum{
width:150px;
height:auto;
}
/* omschrijinvg */
.omschrijving{
width:200px;
height:auto;
}
.aantal {
width:80px;
height:auto;
}
/* land */
.land{
width:150px;
height:auto;
}
inhoud{
width:1305px;
}
<style type="text/css">
th {
background-color: rgb(77, 160, 255);
margin-left: 4px;
margin-bottom: 4px;
color: rgb(255, 255, 255);
}
table caption {
font-size: 2em;
font-weight: bold;
}
</style>
<table>
<caption>Inoud van de box:</caption>
<thead>
<tr>
<th>Naam product</th>
<th>Omschrijving</th>
<th>Antal</th>
<th>Datum toegevoegd</th>
<th>Naam toevegoer</th>
<th>Datum verwijderd</th>
<th>Naam verwijderd</th>
<th> </th>
<th> </th>
<th>SAMPLE SAMPLE SAMPLE SAMPLE</th>
</tr>
</thead>
</table>