Css 右对齐导航栏按钮
我已经使用了帮助。但是我无法使按钮浮动到导航栏的右侧,即使我复制了相同的代码。 这是我的密码Css 右对齐导航栏按钮,css,Css,我已经使用了帮助。但是我无法使按钮浮动到导航栏的右侧,即使我复制了相同的代码。 这是我的密码 <!DOCTYPE html> <html lang="en"> <head> <title>{% block title %}Auctions{% endblock %}</title> <meta charset="utf-8"> <met
<!DOCTYPE html>
<html lang="en">
<head>
<title>{% block title %}Auctions{% endblock %}</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
<style>
/* Remove the navbar's default rounded borders and increase the bottom margin */
.navbar {
margin-bottom: 50px;
border-radius: 0;
}
</style>
{%block title%}拍卖{%endblock%}
/*删除导航栏的默认圆角边框并增加底部边距*/
navbar先生{
边缘底部:50px;
边界半径:0;
}
-
-
-
{%if user.u经过身份验证%}
- {{user.username}
{%else%}
-
-
{%endif%}
您使用的css样式仅对包含a标记的列表元素有效。这是一个肮脏的修正:
<li><span class="glyphicon glyphicon-user"></span>{{ user.username }}</li>
我在这里所做的是从官方代码中获取,只是添加了您的变量和内容。您可以看到最终代码:
{%block title%}拍卖{%endblock%}
navbar先生{
边缘底部:50px;
边界半径:0;
}
{%if user.u经过身份验证%}
{%else%}
{%endif%}
我这样做了,但并没有解决类别后按钮向右浮动的问题。谢谢!我只是复制粘贴了你的代码,效果很好。我不确定我做错了什么sigh@prison-迈克,非常感谢你。很乐意帮忙:)和我的回答一样,他加了假a标签;)@托比亚斯不确定,但至少我会更新我的答案,因为我钦佩每个人的努力@托比亚斯我已经更新了答案;祝你今天愉快:)
<li><span class="glyphicon glyphicon-user"></span>{{ user.username }}</li>
<li><a href="#"><span class="glyphicon glyphicon-user"></span>{{ user.username }}</a></li>
padding-top: 15px;
padding-bottom: 15px;
color: #9d9d9d;