Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/85.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_Jquery_Html_Css - Fatal编程技术网

Php 文本溢出并在下面给我一个滚动条

Php 文本溢出并在下面给我一个滚动条,php,jquery,html,css,Php,Jquery,Html,Css,我有一个问题:我已经用PHP创建了一个简单的聊天框,我的消息保存在我的数据库中,但是每当我键入非常长的文本,PHP将其返回到我的页面,我的页面将创建一个非常长的滚动条来显示所有文本。我一直想要的是,当我键入一个很长的文本时,它会自动下降,不会创建滚动条 我想给你看我聊天室的屏幕截图 我已经尝试过更改宽度s、高度s和nowrap, 但还是没能成功 这是shoutbox.php,其中包括shouts.php: <?php mysql_connect("localhost","root",""

我有一个问题:我已经用PHP创建了一个简单的聊天框,我的消息保存在我的数据库中,但是每当我键入非常长的文本,PHP将其返回到我的页面,我的页面将创建一个非常长的滚动条来显示所有文本。我一直想要的是,当我键入一个很长的文本时,它会自动下降,不会创建滚动条

我想给你看我聊天室的屏幕截图

我已经尝试过更改
宽度
s、
高度
s和
nowrap
, 但还是没能成功

这是shoutbox.php,其中包括shouts.php:

<?php

mysql_connect("localhost","root","");
mysql_select_db('try');

$submit=isset($_POST['sub']);

if ($submit)
{

    $message=$_POST['message'];
    mysql_select_db('try');
    $queryreg=mysql_query("INSERT INTO message(ID,message) VALUES('','$message')") or die (mysql_error());
}
?>

<html>
<head>
    <meta http-equiv="content-type" content="html/text"/>
    <style type="text/css">

        body
        {
            font-family:Tahoma;
            font-size:10pt;
            background-image:url(dota2background.jpg);
            -moz-background-size: cover;
            -webkit-background-size: cover;
            background-size: cover;
            background-position: top center !important;
            background-repeat: no-repeat !important;
            background-attachment: fixed;
        }
        #shouts
        {
            border:1px solid #000;
            width:1248px;

            white-space: nowrap;
        }
    </style>
</head>

<body>

    <form action="shoutbox.php" method="post">
        <table border="1" width="1248" style="border:0;" cellpadding="5">
        <tr>
        <td><br/>Message:<textarea cols="50" rows="2" name="message" style="resize:none;"></textarea><input type="submit" name="sub" value="send">
        </tr>
        <tr>
            <td width="1024px"><div id="shouts">
                <iframe name="shouts" src="shouts.php" width="1248px" height="720px" frameborder="0" scrolling="auto"></iframe>
                </div>
        </tr>
        </table>
        <b>

    </form>
</body>
</html>

在显示消息的位置添加两行css

.messages {
   float:  left;
   clear: left;
}

table{
   word-wrap: break-word;
}

检查小提琴:

除非你发布一些代码,否则帮不上忙……先生。。对不起,我忘了寄了。第一次来这里..我试过了,先生。但它并没有起作用,它使得每条评论的边框只是向左转,但文本仍然是重叠的。。但是谢谢你,先生helping@Hoodedwarlock先生,您是否在显示shoutit中的值仍然重叠。等等,我会上传它的照片。是的,先生。每次我发送一条消息时,shout.php都会回显消息内容send@Hoodedwarlockk,更新我的答案,让我知道它现在是否有效
.messages {
   float:  left;
   clear: left;
}

table{
   word-wrap: break-word;
}