gpt4 book ai didi

html - 我怎样才能让我的按钮居中,
不起作用

转载 作者:行者123 更新时间:2023-11-28 00:29:10 29 4
gpt4 key购买 nike

我只是制作一个页面或类似的东西。我想让我的按钮居中,但它不起作用。

我尝试用不同的方法将它居中,但它不起作用。看看代码。它有但它并没有将它置于整个页面的中心但只是喜欢......我不知道。照片:http://prntscr.com/mfrkam

<div class="form-group">
<div class="row">
<center>
<input type="submit" class="btn btn-outline-success" name="submit" value="Add Website">
&nbsp;&nbsp;&nbsp;&nbsp;
<input type="reset" class="btn btn-outline-danger" name="cancel" value="Cancel">
</center>

</div>
</div>

最佳答案

<center>引入 HTML5 时不推荐使用标签。要使文本内容(包括按钮)居中,请将内容包装在一个 div 中,为该 div 指定一个类或唯一 ID,然后使用 CSS 定位该 div。应用 text-align: center; 的 CSS 规则到那个分区。

试试这个:

<!-- style tags allow CSS to be written in an HTML file -->
<style>
/* centers all the text in the div with a class of row */
.row {
text-align: center;
}
</style>
<div class="form-group">
<div class="row">
<input type="submit" class="btn btn-outline-success" name="submit" value="Add Website">
&nbsp;&nbsp;&nbsp;&nbsp;
<input type="reset" class="btn btn-outline-danger" name="cancel" value="Cancel">
</div>
</div>

请注意,为所有 CSS 包含一个单独的文件是公认的最常见的做法。它在这里与样式标签一起工作,但这不是标准做法。希望这对您有所帮助!

关于html - 我怎样才能让我的按钮居中,<center> </center> 不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54496697/

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