Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/82.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/41.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_Header_Position - Fatal编程技术网

Html 空间<;文章>&书信电报;标题>;定位

Html 空间<;文章>&书信电报;标题>;定位,html,css,header,position,Html,Css,Header,Position,我有以下问题。 我想有标题(位置:固定)和一些文字在文章部分和这部分之间的一些空间 我的CSS代码: header { position: fixed margin-bottom: 10px; // <-- space I'd like to have } 标题 { 位置:固定 页边距底部:10px;//您需要在文章标签上使用页边距 header { background: #ddd; position: fixed; top: 0;

我有以下问题。 我想有标题(位置:固定)和一些文字在文章部分和这部分之间的一些空间

我的CSS代码:

header 
{
    position: fixed

    margin-bottom: 10px; // <-- space I'd like to have
}
标题
{
位置:固定

页边距底部:10px;//您需要在
文章
标签上使用
页边距

header {
    background: #ddd;
    position: fixed;
    top: 0;
    /* width: 100%; */ /* You would probably need this */ 
}

article {
    margin-top: 50px;
}

(您创建的小提琴的最新演示)


解释一下,您正在使用
页眉
标记上的
页边距底部
,这是一个
固定的
位置
元素,现在当您对任何元素进行修复时,它只是从文档流中消失,而您的
页边距
对文档上的任何元素都不会产生任何影响

另外,请记住对
标题
元素使用
top:0;
,或者当您在
文章
上使用
页边距top
时,也会使用
标题
元素


使用
/
的注释无效,您需要使用
/*注释位于此处*/


您需要在
article
标签上使用
margin

header {
    background: #ddd;
    position: fixed;
    top: 0;
    /* width: 100%; */ /* You would probably need this */ 
}

article {
    margin-top: 50px;
}

(您创建的小提琴的最新演示)


解释一下,您正在使用
页眉
标记上的
页边距底部
,这是一个
固定的
位置
元素,现在当您对任何元素进行修复时,它只是从文档流中消失,而您的
页边距
对文档上的任何元素都不会产生任何影响

另外,请记住对
标题
元素使用
top:0;
,或者当您在
文章
上使用
页边距top
时,也会使用
标题
元素


使用
/
的注释无效,您需要使用
/*注释位于此处*/


您需要在
article
标签上使用
margin

header {
    background: #ddd;
    position: fixed;
    top: 0;
    /* width: 100%; */ /* You would probably need this */ 
}

article {
    margin-top: 50px;
}

(您创建的小提琴的最新演示)


解释一下,您正在使用
页眉
标记上的
页边距底部
,这是一个
固定的
位置
元素,现在当您对任何元素进行修复时,它只是从文档流中消失,而您的
页边距
对文档上的任何元素都不会产生任何影响

另外,请记住对
标题
元素使用
top:0;
,或者当您在
文章
上使用
页边距top
时,也会使用
标题
元素


使用
/
的注释无效,您需要使用
/*注释位于此处*/


您需要在
article
标签上使用
margin

header {
    background: #ddd;
    position: fixed;
    top: 0;
    /* width: 100%; */ /* You would probably need this */ 
}

article {
    margin-top: 50px;
}

(您创建的小提琴的最新演示)


解释一下,您正在使用
页眉
标记上的
页边距底部
,这是一个
固定的
位置
元素,现在当您对任何元素进行修复时,它只是从文档流中消失,而您的
页边距
对文档上的任何元素都不会产生任何影响

另外,请记住对
标题
元素使用
top:0;
,或者当您在
文章
上使用
页边距top
时,也会使用
标题
元素


使用
/
的注释无效,您需要使用
/*注释位于此处*/

可能就是您想要的。您需要在
标题
后面的元素上设置一个边距,该边距的值等于标题+10。您必须这样做,因为元素
标题
有一个位置
固定
,可以“删除”它来自文档的自然流,即它将位于其余内容的顶部,而其他内容忽略它。因此,
文章
忽略标题的位置并占据其位置

header {
    position: fixed;
    height: 100px;
    width: 100%;
    background: red;
    top: 0;
}

article {
    width: 100%;
    margin-top: 110px; /* height header + 10px */
    background: blue;
}
如果页眉的高度是动态的,那么可以使用jQuery(或JS)设置文章的页边距顶部

编辑:我编辑了你的,现在效果很好。

可能就是你想要的。你需要在
标题
后面的元素上设置一个边距,该边距的值等于标题+10。你必须这样做,因为元素
标题
有一个“删除”的位置它来自文档的自然流,即它将位于其余内容的顶部,而其他内容忽略它。因此,
文章
忽略标题的位置并占据其位置

header {
    position: fixed;
    height: 100px;
    width: 100%;
    background: red;
    top: 0;
}

article {
    width: 100%;
    margin-top: 110px; /* height header + 10px */
    background: blue;
}
如果页眉的高度是动态的,那么可以使用jQuery(或JS)设置文章的页边距顶部

编辑:我编辑了你的,现在效果很好。

可能就是你想要的。你需要在
标题
后面的元素上设置一个边距,该边距的值等于标题+10。你必须这样做,因为元素
标题
有一个“删除”的位置它来自文档的自然流,即它将位于其余内容的顶部,而其他内容忽略它。因此,
文章
忽略标题的位置并占据其位置

header {
    position: fixed;
    height: 100px;
    width: 100%;
    background: red;
    top: 0;
}

article {
    width: 100%;
    margin-top: 110px; /* height header + 10px */
    background: blue;
}
如果页眉的高度是动态的,那么可以使用jQuery(或JS)设置文章的页边距顶部

编辑:我编辑了你的,现在效果很好。

可能就是你想要的。你需要在
标题
后面的元素上设置一个边距,该边距的值等于标题+10。你必须这样做,因为元素
标题
有一个“删除”的位置它来自文档的自然流,即它将位于其余内容的顶部,而其他内容忽略它。因此,
文章
忽略标题的位置并占据其位置

header {
    position: fixed;
    height: 100px;
    width: 100%;
    background: red;
    top: 0;
}

article {
    width: 100%;
    margin-top: 110px; /* height header + 10px */
    background: blue;
}
如果页眉的高度是动态的,那么可以使用jQuery(或JS)设置文章的页边距顶部


编辑:我编辑了你的,现在效果很好。

这里最好的做法是