Html CSS页边距底部属性不工作

Html CSS页边距底部属性不工作,html,css,Html,Css,我定义了这个CSS类,并将其应用于一行文本,希望将其放置在页面的最底部,但它没有。它漂浮在页面的中间。你怎么了 #bottom { margin: auto; margin-bottom:0px; } HTML: 我想,你要做的是在页面底部粘贴一条文本。 所以CSS应该看起来像 #bottom { position:fixed; bottom: 0px; } 但是如果没有更详细的描述,我不知道,这是否是你想要做的 边距不是要使用的属性。也许可以看看这里的描

我定义了这个CSS类,并将其应用于一行文本,希望将其放置在页面的最底部,但它没有。它漂浮在页面的中间。你怎么了

#bottom {        
    margin: auto;
    margin-bottom:0px;  
}
HTML:


我想,你要做的是在页面底部粘贴一条文本。 所以CSS应该看起来像

#bottom { position:fixed; bottom: 0px; }
但是如果没有更详细的描述,我不知道,这是否是你想要做的

边距不是要使用的属性。也许可以看看这里的描述:

这将解决您的问题

如果您需要底部保持在页面底部,则

CSS:

或者,如果需要在视口/屏幕底部显示,则:

CSS


它是在外部CSS文件中定义的。这很好,但是CSS本身是没有意义的。它仅在呈现的HTML文件的上下文中具有意义。如果没有看到您试图显示的HTML,您的问题将无法得到回答。这确实有效,但我更改为text align:center。为什么我需要左:0和右:0?
#bottom { position:fixed; bottom: 0px; }
#bottom {
     bottom: 0;
    left: 0;
    position: fixed;
    right: 0;
    text-align: left; 
}
#bottom {
    position: absolute;
    top: 100%;
}

html,
body {
    height: 100%;
    width: 100%;
    margin: 0;
}
    #bottom {
        position: fixed;
        bottom: 0;
    }

    html,
    body {
        height: 100%;
        width: 100%;
        margin: 0;
    }