我如何移动a";提交;HTML页面右侧的按钮?
如何将“提交”按钮移动到HTML页面的右侧?最后一个单选选项似乎与最后一个提交按钮一起被压扁。我试着加上break,但没用我如何移动a";提交;HTML页面右侧的按钮?,html,css,twitter-bootstrap,Html,Css,Twitter Bootstrap,如何将“提交”按钮移动到HTML页面的右侧?最后一个单选选项似乎与最后一个提交按钮一起被压扁。我试着加上break,但没用 {%extends "new_base.html"%} {%block content%} <style> a.mylinklist{ display:block; } </style> <div class="wrap size-1 " > <h2>&
{%extends "new_base.html"%}
{%block content%}
<style> a.mylinklist{
display:block;
}
</style>
<div class="wrap size-1 " >
<h2><strong>Question...</strong>click on the correct answer!</h2>
<a href = "{{url_for("index")}}">back to home</a>
<div class = "container" style="width:30%;margin:auto">
<img style="width:100%;height:100%%;object-fit: cover;" src="{{url_for("static", filename="images/" + image)}}"></div></h2>
<br>
<div class="bg-white shadow" style="text-align:center">
<ul class="flexblock reasons" style="height:100%">
<h2 >
<p>{{question}}</p>
</h2>
{% with messages = get_flashed_messages() %}
{% if messages %}
{% for msg in messages %}
<p>{{ msg }}</p>
{% endfor %}
{% endif %}
{% endwith %}
<br>
<br>
<form class="longform" method="POST" action="#" style="margin:auto;display:flex">
{%for opt in options%}
<input class="form-control" type="radio" name="answer" value="{{opt}}" style="display:align;flex-grow:1">
{{options[opt]}}
</input>
{%endfor%}
<button class="btn btn-primary" type="submit" method="POST" style="width:25%;text-align:center;">SUBMIT </button>
</form>
</div>
</div>
{%endblock%}
{%extensed“new_base.html”%}
{%block content%}
a、 我的链接列表{
显示:块;
}
问题…点击正确答案!
{%with messages=get_flashed_messages()%}
{%if消息%}
{消息%中的msg为%0}
{{msg}}
{%endfor%}
{%endif%}
{%endwith%}
{%用于选择加入选项%}
{{options[opt]}
{%endfor%}
提交
{%endblock%}
我看到您正在使用引导,所以我假设您可以访问库中的所有类。您可以按如下方式编辑提交方法
<button class="btn btn-primary float-right" type="submit" method="POST">SUBMIT </button>
提交
我删除了内联CSS,如果您需要额外的样式,您仍然可以添加它。如果您使用的是引导,您可以将这个类作为
<button class="btn btn-primary float-right" type="submit" method="POST" style="width:25%;text-align:center;">SUBMIT </button>
提交
要了解有关引导浮动类的更多信息,请检查
您也可以这样做,而无需引导
<button class="btn btn-primary" type="submit" method="POST" style="width:25%;text-align:center;float-right">SUBMIT </button>
提交
了解更多有关css浮点属性的信息
您共享的html存在多个问题,例如不必要的结束h2标记,您还应该查看
如果您仍然无法将按钮向右移动,请尝试使用此更新替换表单开始标记
<form class="longform" method="POST" action="#" style="margin: auto">
向右浮动。。。好的,我会试试我试过你的建议,我仍然有同样的问题。请参阅附加的屏幕截图。第一个屏幕截图包含两个提交按钮,其中包含旧按钮和新按钮,而第二个屏幕截图仅包含新提交按钮。按钮似乎会自动对齐?