Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/72.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和css中将导航栏设置为已满且未打开窗口?_Html_Css - Fatal编程技术网

如何在html和css中将导航栏设置为已满且未打开窗口?

如何在html和css中将导航栏设置为已满且未打开窗口?,html,css,Html,Css,嘿,伙计们,我一直在努力使这个标题或导航栏全屏无填充,但不能。尝试将填充设置为0,但无法。请帮助我,伙计们,我已经尝试了很长时间了。干杯 这是我的密码:- <!DOCTYPE html> <html> <head> <title>Shopifter</title> <link rel="stylesheet" type="text/css" href="sty

嘿,伙计们,我一直在努力使这个标题或导航栏全屏无填充,但不能。尝试将填充设置为0,但无法。请帮助我,伙计们,我已经尝试了很长时间了。干杯

这是我的密码:-

<!DOCTYPE html>
        <html>
        <head>
            <title>Shopifter</title>
        <link rel="stylesheet" type="text/css" href="style1.css">
        </head>
        <body>
        <header>
            <nav>
                <div> <a href="index.php"> Home </a></div>
                <div align="center"> <h2>Welcome to Shopifter</h2></div>
                <div align="right">
                    <button> Sign in</button>
                    <button> Sign up</button>
                </div>
            </nav>
        </header>
        </body>
        </html>

body {
        background-color: grey;
    }

    header {
        margin: 0 auto;
        width: 100%;
        height: 100px;
        background-color: #fff;
        padding: 0;
    }

    header nav {
        margin: 0px;
        width: 100%;
        height: 100px;
        background-color: #fff;
    }

将正文边距设置为0:body{margin:0;}

如果您想为正文保留此页边距,请将负页边距添加到标题nav{margin:-8px;},但也从中删除宽度:100%

addmargin:0;到身体


你需要CSS,而且你没有显示你的CSS。宽度:100%;还有,你说的全屏是什么意思?请更清楚,如果可能的话发布屏幕截图。你是否尝试过将正文和html上的填充设置为0?@h3raldo yes尝试过,没有帮助!没问题,这是基本的css知识,只要试着在开发者工具中查看你喜欢的浏览器的网站,并使用不同标签的样式就可以了。祝你好运