Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/solr/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 使div的宽度不达到页面的末尾_Html_Css - Fatal编程技术网

Html 使div的宽度不达到页面的末尾

Html 使div的宽度不达到页面的末尾,html,css,Html,Css,所以我正在制作一个Flask web应用程序,我有一个导航条。此导航栏的背景色可到达页面的水平两端。我如何更改此设置,使背景颜色仅位于内容后面?任何帮助都将不胜感激 Html: 这就是你想要做的吗 我只是在导航栏中添加了以下代码: display: block; <!--convert div to block element--> max-width: 90%; <!--make div 90% width of container --> margin: 0 auto

所以我正在制作一个Flask web应用程序,我有一个导航条。此导航栏的背景色可到达页面的水平两端。我如何更改此设置,使背景颜色仅位于内容后面?任何帮助都将不胜感激

Html:


这就是你想要做的吗

我只是在导航栏中添加了以下代码:

display: block; <!--convert div to block element-->
max-width: 90%; <!--make div 90% width of container -->
margin: 0 auto; <!--center the div -->

{%block head%}{%endblock%}
主页
使用者
*{
    margin:0;
    padding:0;
}
html{
    background-color: thistle;
}
.navBar{
    background-color: darkslategrey;
}
#flex-container{
    display:flex;
    justify-content: center;
    align-items: center;
    flex-wrap:wrap;
    flex-direction: row;
    border-radius: 13px;
    position:relative;
}   
.navButton {
    padding:10px 20px;
    margin:8px;
    font-family: Georgia, 'Times New Roman', Times, serif;
    border: none;
    box-shadow: rgb(133, 131, 131) 3px 3px;
    
}
.navButton:hover{
    box-shadow: rgb(104, 101, 101) 5px 5px;
}
display: block; <!--convert div to block element-->
max-width: 90%; <!--make div 90% width of container -->
margin: 0 auto; <!--center the div -->