Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/41.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数组在设置样式后是垂直的,而不是水平的_Php_Css - Fatal编程技术网

php数组在设置样式后是垂直的,而不是水平的

php数组在设置样式后是垂直的,而不是水平的,php,css,Php,Css,我有一系列的信。添加样式后,阵列从水平方向变为垂直方向 代码如下: $alphabetical_array = range('a','z'); function AddLinks($letter) { $title = strtoupper($letter); $a = "<a href='alpha_search.php?letter=".$letter."' class='alphabtn'><font color='#FFFFFF'>".$title."</f

我有一系列的信。添加样式后,阵列从水平方向变为垂直方向

代码如下:

$alphabetical_array = range('a','z');
function AddLinks($letter)
{
$title = strtoupper($letter);
$a = "<a href='alpha_search.php?letter=".$letter."' class='alphabtn'><font color='#FFFFFF'>".$title."</font></a>";
return($a);
}

$format_array = array_map("AddLinks", $alphabetical_array);
echo implode($format_array);
你有

clear: both;
放在你的标签上。很肯定这会导致

将被视为块并断开到新行


尝试删除它。

您有
显示:块。这将导致每个元素显示在其自己的行上。卸下它,其他一切都会好起来。

更改

.alphabtn {
    max-width:10px;
    text-decoration: none;
    position: relative;
    padding: 5px ;
    text-align:left;
    clear: both; 
    text-indent:0;
    display: block;


同时移除显示:块;你的建议确实给了我一个主意,所以我去掉了显示屏:block,这就成功了。谢谢字体标签?人们还在用那些?
.alphabtn {
    max-width:10px;
    text-decoration: none;
    position: relative;
    padding: 5px ;
    text-align:left;
    clear: both; 
    text-indent:0;
    display: block;
.alphabtn {
    max-width:10px; //Why this line?
    text-decoration: none;
    position: relative;
    padding: 5px ;
    text-align:left;
    text-indent:0;
    display: inline-block; (or delete the row)