Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/331.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/91.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
Python 为什么我有一个带有css&;的水平滚动条;html_Python_Html_Css_Flask - Fatal编程技术网

Python 为什么我有一个带有css&;的水平滚动条;html

Python 为什么我有一个带有css&;的水平滚动条;html,python,html,css,flask,Python,Html,Css,Flask,我用一些html建立了一个简单的基于flask的网站: <!DOCTYPE html> <html> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <head> <link rel="stylesheet" type="text/css" href={{ url_for('static', filename='common.css') }}>

我用一些html建立了一个简单的基于flask的网站:

<!DOCTYPE html>
<html>
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<head>
<link rel="stylesheet" type="text/css" href={{ url_for('static', filename='common.css') }}>
</head>


<div id="main_div">

<form action="/login" method="post">
      <br>
      <input type="text" name="user_name" placeholder="Username">
      <br><br>
      <input type="password" name="password" placeholder="Password">
      <br><br>
      <input type="submit" value="Login" id="button">
</form>

</div>

</html>

我试图使手机友好,并试图避免基于像素的测量。问题是,在桌面模式下,我一直得到这个水平滚动条。我不想只隐藏滚动条,我只想停留在查看端口的领域。你知道发生了什么事吗

将位置更改为绝对形式元素应有助于:

form {
 text-align: left;
 position: absolute;
 top: 50vh;
 left: 50vw;
}

成功了!谢谢您!与滚动条问题无关,但指定
标记的样式不是一个好习惯,因为它们不可见elements@senox13谢谢您!我会把它去掉。
form {
 text-align: left;
 position: absolute;
 top: 50vh;
 left: 50vw;
}