在PHP/CSS中添加滚动条


Adding a scrollbar in PHP/CSS

如何将滚动条添加到数据库输出的信息中:

IE:

DATA   S  /'
DATA   C  ||
DATA   R  ||
DATA   O  ||
DATA   L  ||
DATA   L  ||
DATA   B  ||
DATA   A  ||
DATA   R  '/
代码:

<?php
   mysql_connect("localhost","user","pass") or die("Could not connect to localhost");
   mysql_select_db("db") or die( "Could not connect to database");
?>
    <p class="scroll">
<?php
   $result = mysql_query("SELECT * FROM this ORDER BY name ASC");
    while ($row = mysql_fetch_array($result)) {
        echo "<div style='margin: 0 auto;'>
                    <span style='display:inline-block; width:200px; text-align:left;'>" . ucwords($row['name']) . "</span>
                    <span style='display:inline-block; text-align:left;'>" . ucwords($row['number']) . "</span>
                </div>
                <br>";
   }
?>
   </p>
 </font>
</div>
(css)

.scroll 
{
    overflow:scroll;
}

如何将滚动条添加到输出的右侧并使其向下滚动以查看显示的所有数据?

try this…

.scroll {
    width: 100px;
    height: 100px;
    overflow: scroll;
}

试试这个:

.scroll {
    overflow-y: scroll;
    width: 200px;
    height: 200px;
}

你不需要overflow: scroll;,除非你也想要一个水平滚动条。你还需要给它一个宽度和高度