gpt4 book ai didi

html - 带有按钮的垂直和水平居中数据列表框

转载 作者:太空宇宙 更新时间:2023-11-04 15:58:02 25 4
gpt4 key购买 nike

试图通过将它对齐到中心(垂直和水平)来设置我的数据列表的样式,但我只能水平居中而不是垂直。

有没有办法增加数据列表框的宽度并做一些样式。请帮助..

$('#btn').click(function() { // The `$` reference here is a jQuery syntax. So we are loading jquery right before this script tag
var textval = $('#textcat').val();
window.location = "1stlink.php?variable=" + encodeURIComponent(textval);
});
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

<div class="container">
<div class="row">
<div class="col-md-6 col-md-offset-3">
<div class="text-center">
<input list="category" name="category" id="textcat" placeholder="Enter your area..">
<datalist id="category">
<option id="www.google.com" value="fruits" />
<option id="www.fb.com" value="animals" />
<option id="www.ymail.com" value="vechiles" />
<option id="www.msn.com" value="ornaments" />
</datalist>
<input id="btn" type="button" value="submit">

</div>
</div>
</div>

最佳答案

在“输入”元素中,您可以根据自己的喜好轻松调整元素宽度。

请参阅此页面以获取更多信息 https://www.w3schools.com/css/css_form.asp

$('#btn').click(function() { // The `$` reference here is a jQuery syntax. So we are loading jquery right before this script tag
var textval = $('#textcat').val();
window.location = "1stlink.php?variable=" + encodeURIComponent(textval);
});
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<div class="container">
<div class="row" style="width: 100%; padding-top: 25%">
<div class="col-md-6 col-md-offset-3">
<div class="text-center">
<input style="width: 100%" list="category" name="category" id="textcat" placeholder="Enter your area..">
<datalist id="category">
<option id="www.google.com" value="fruits" />
<option id="www.fb.com" value="animals" />
<option id="www.ymail.com" value="vechiles" />
<option id="www.msn.com" value="ornaments" />
</datalist>
<input id="btn" type="button" value="submit">
</div>
</div>
</div>

关于html - 带有按钮的垂直和水平居中数据列表框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43954058/

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