大家好,关于 CSS 的快速问题。在 my website ,如果导航栏居中并固定到标题的底部(渐变的底部),我会喜欢它。我不知道该怎么做。
该站点不支持 IE...但是。
最佳答案
将您的“标题”标签设为相对位置。然后将'nav'标签设为绝对位置,并对其执行'bottom:0'。全部在您的 CSS 中。它应该有效。 然后使用 css 中的“左”和“右”规则将其向左或/和向右移动。
像这样:
header {
position: relative;
zoom: 1; /*needed to clear float in IE*/
}
header:after {
clear: both;
display: block;
content: " ";
visibility: hidden;
height: 0;
}
nav {
position: absolute;
bottom: 0;
}
关于html - 居中并固定到父级的底部,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3770350/