我有一件相当简单的事情要做。我仍在处理CSS的所有陷阱,所以请耐心等待。我想基本上取一个div,将它放置在
HTML:
CSS:
事实上,我正在使用Bootstrap,而
有人能帮我做到这一点吗?我只需要让
position: absolute; left: 10px; right: 10px; bottom: 10px
,然后将其子元素水平居中在浏览器中。 这是我的尝试:HTML:
<div class="notificashun-holder">
<div class="alert-message info notificashun">
<p>Hello, World!</p>
</div>
</div>
CSS:
.notificashun-holder {
display: block;
bottom: 10px;
left: 10px;
right: 10px;
position: absolute;
}
.notificashun {
display: inline-block;
margin: 0 auto;
}
事实上,我正在使用Bootstrap,而
alert-message
类使项目display:block
,因此我需要将它们“缩小”到正常大小(仅适合其内容的大小)。有人能帮我做到这一点吗?我只需要让
notificashun-holder
距离浏览器左侧、右侧和底部各为十个像素,并且notificashun
只需尽可能小并居中于notificashun-holder
中。