gpt4 book ai didi

css - 屏幕尺寸 350px 或更小的响应式网格

转载 作者:行者123 更新时间:2023-11-28 08:40:21 26 4
gpt4 key购买 nike

对于小于 350 像素的屏幕,我希望第二列出现在下一行。但目前它发生在超小屏幕(768px)(我在我的代码中做同样的事情)。对于 350px 或更小的屏幕尺寸有什么办法吗?这就是我正在做的:

<html>
<head>
<link type="text/css" rel="stylesheet" href="bootstrap.min.css"/>
<style>
@media (max-width: 768px) {
.Labels {
text-align: center;
float: none;
}
.InputFields {
text-align: center;
float: none;
}
}
</style>
</head>
<body>
<div class="container-fluid" style="border:1px solid grey;">
<div class="row">
<div class="col-xs-12 col-sm-6 Labels" style="text-align: right;">FirstName</div>
<div class="col-xs-12 col-sm-6 InputFields" style="text-align: left;"><input type="text" size="20" maxlength="50"></div>
<div class="row">
<div class="col-xs-12 col-sm-6 Labels" style="text-align: right;">LastName</div>
<div class="col-xs-12 col-sm-6 InputFields" style="text-align: left;"><input type="password" size="20" maxlength="50"></div>
</div>
</div>
</body>
</html>

最佳答案

您没有关闭第一行结尾的 div。

为了满足您的要求,您需要进行一些小的修改。

我的代码。试试这个

<html>
<head>
<!-- <link type="text/css" rel="stylesheet" href="bootstrap.min.css"/>-->
<link rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">
<!-- loads the bootstrap css -->

<style>
.col-xs-6{
width: 35%;
}
</style>
</head>
<body>
<div class="container-fluid" style="border:1px solid grey;">
<div class="row"><!-- first row -->
<div class="col-xs-6 col-sm-6" style="text-align: right;">FirstName</div>
<div class="col-xs-6 col-sm-6" style="text-align: left;">
<input type="text" size="20" maxlength="50"></div>
</div><!-- end of first row -->
<div class="row"><!-- second row -->
<div class="col-xs-6 col-sm-6" style="text-align: right;">LastName</div>
<div class="col-xs-6 col-sm-6" style="text-align: left;">
<input type="password" size="20" maxlength="50"></div>
</div>
</div>
</body>
</html>

关于css - 屏幕尺寸 350px 或更小的响应式网格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27835411/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com