我正在尝试让一些信息位于我使用 Div 创建的侧面板旁边。
我曾尝试将文本 float 在左侧,但这没有用。
这是我的 Click here
这就是我想要的 Click here
我会向您展示我的页面和我正在使用的样式表:D
页面: 健身中心
<div class="SidePanel">
Text
</div>
<div class="WelcomeText">
</div>
<?php
$db = new mysqli("127.0.0.1", "root", "root", "fitnessbooking");
$query= $db->query("select Username from users where Username = '$_POST[username]' and Pass = '$_POST[password]'");
if ($query->num_rows ==1){
echo "";
}
else {
header("Location: http://localhost/pages/login.php?fail=1");
exit;
}
?>
</body>
</html>
样式表:
.SidePanel {
background-color: white;
width: 250px;
height: 100%;
}
.WelcomeText {
Float left;
}
最佳答案
首先,请注意您的代码容易受到 SQL 注入(inject)攻击。您应该使用参数化查询或至少转义它们。
http://php.net/manual/en/security.database.sql-injection.php
其次,将两个元素向左浮动:
.SidePanel { float: left; }
.WelcomeText { float: left; }
关于html - 让文本位于侧面板旁边,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38383277/