Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/86.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 在网页周围添加边界_Html_Css - Fatal编程技术网

Html 在网页周围添加边界

Html 在网页周围添加边界,html,css,Html,Css,我想在网页的四面添加边界(黑色25px宽度)。现在它不走运了 请访问我的JSFIDLE 部分css: body { font-size: .85em; font-family: "Segoe UI" , Verdana, Helvetica, Sans-Serif; margin: 25px; padding: 0; background-color: #000000; } 去掉body元素的背景和边距,将内容添加到HTML元素中: * { /*this * selector selects

我想在网页的四面添加边界(黑色25px宽度)。现在它不走运了

请访问我的JSFIDLE

部分css:

body {
font-size: .85em;
font-family: "Segoe UI" , Verdana, Helvetica, Sans-Serif;
margin: 25px;
padding: 0;
background-color: #000000;
}

去掉body元素的背景和边距,将内容添加到HTML元素中:

* { /*this * selector selects every element*/
    box-sizing: border-box;
}

html{
    background: #000;
    padding: 25px;
}

body {
    font-size: .85em;
    font-family: "Segoe UI" , Verdana, Helvetica, Sans-Serif;
}
(也可以在所有内容上使用
框大小:边框框;
以避免边距和填充错误)



我还删除了
位置:绝对从页脚开始。现在它的行为。

*{box size:border box;},我指的是第一个代码。*意味着一切?我发现若我去掉位置:溶质;那么一切都好了。不需要改变其他部分。为什么要否决投票?请给我一个理由……我理解否决票,你只为你的问题发布了部分代码,如果你发布了一个更完整的示例,不是你的整个页面代码,而是一些HTML以及与问题相关的CSS,对我们来说会更好。