[英]How to change the width of the header & make it responsive too
I didn't change any code, but the navbar is shortened automatically If I set width="300px"
the header becomes unresponsive我没有更改任何代码,但导航栏会自动缩短如果我设置width="300px"
标题变得无响应
Header Code:标题代码:
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="container-fluid">
<a class="navbar-brand" href="{{ url_for('home.home_') }}">
<img alt="Quizz" height="70" src="../static/logo.png" width="70">
</a>
<button aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation"
class="navbar-toggler" data-bs-target="#navbarSupportedContent"
data-bs-toggle="collapse" type="button">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<li>
<a href="{{ url_for('login_system.logout') }}"><button class="btn btn-success">Log Out</button></a>
</li>
{% else: %}
<li>
<a href="{{ url_for('login_system.register') }}"><button class="btn btn-primary">Sign Up!</button></a>
<a href="{{ url_for('login_system.login') }}"><button class="btn btn-success">Log In</button></a>
</li>
{% endif %}
</ul>
</div>
</div>
</nav>
Note: This a flask template!注意:这是一个烧瓶模板!
What can I do to make it width to full screen?我该怎么做才能使其宽度变为全屏?
Have you set the meta tag yet?你有没有设置元标记? Like <meta name="viewport" content="width=device-width, initial-scale=1.0">
像<meta name="viewport" content="width=device-width, initial-scale=1.0">
There are many ways one can use media queries but this is how i use mine有很多方法可以使用媒体查询,但这就是我使用我的方法
// This Styling Applies When The Width Is 500px like on a mobile // 当宽度为 500px 时应用此样式,例如在移动设备上
@media(max-width:500px){
// The Width Of The Header Will Be whatEverYouWant When The Screen Width Is 500px
header{
width:whatEverWidthYouWant
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.