非常简单的问题。在网站周围钓鱼了一下,似乎没什么用。
我的网站底部有一个粘性导航,不会粘在底部!它不尊重我的身高规则而且没有任何问题。
我尝试过的事情:
诚实地尝试了我所知道的一切。
我的目标是什么:
CSS / HTML / Demo
.fn {
width: 100%;
height: 100%;
max-height: 41px;
bottom: 0;
left: 0;
position: absolute;
background-color: #fff;
}
.fn ul {
text-align: center;
margin: 0;
padding: 0;
list-style: none;
}
.fn li {
display: inline-block;
}
.fn a {
display: block;
padding: 10px 5px 10px 30px;
text-decoration: none;
font-family: "Raleway", sans-serif;
font-size: 1.15em;
letter-spacing: 0.05em;
color: #000;
}
.fn .first {
margin-right: 45.5px;
background-image: url(http://s28.postimg.org/f3f2a8mnd/fi2.png);
background-repeat: no-repeat;
background-position: left center;
background-size: 25px 25px;
top: -14px;
position: relative;
}
.fn .mid {
height: 55px;
bottom: 0;
margin: 0 auto;
z-index: 9998;
}
.fn .mid img {
height: 100%;
display: inline-block;
}
.fn .second {
margin-left: 45.5px;
background-image: url(http://s28.postimg.org/ag908gzah/fi1.png);
background-repeat: no-repeat;
background-position: left center;
background-size: 25px 25px;
top: -14px;
position: relative;
}
<div class="fn">
<ul>
<li> <a href="resume.pdf" target="_blank" class="first" id="L3"> Resume </a>
</li>
<li class="mid">
<img src="http://s18.postimg.org/v70ga0bvt/image.png"></img>
</li>
<li> <a href="mailto:" class="second" id="L4"> Contact </a>
</li>
</ul>
</div>
答案 0 :(得分:1)
您必须将绝对位置更改为已修复和垂直对齐 li元素顶部。
.fn {
width: 100%;
height: 100%;
max-height: 50px;
bottom: 0;
left: 0;
position: fixed;
background-color: #fff;
}
.fn ul {
text-align: center;
margin: 0;
padding: 0;
list-style: none;
}
.fn li {
display: inline-block;
vertical-align: top;
}
.fn a {
display: block;
padding: 10px 5px 10px 30px;
text-decoration: none;
font-family:"Raleway", sans-serif;
font-size: 1.15em;
letter-spacing: 0.05em;
color: #000;
}
.fn .first {
margin-right: 45.5px;
background-image: url(http://s28.postimg.org/f3f2a8mnd/fi2.png);
background-repeat: no-repeat;
background-position: left center;
background-size: 25px 25px;
position: relative;
}
.fn .mid {
height: 55px;
bottom: 0;
margin: 0 auto;
z-index: 9998;
}
.fn .mid img {
height: 100%;
display: inline-block;
}
.fn .second {
margin-left: 45.5px;
background-image: url(http://s28.postimg.org/ag908gzah/fi1.png);
background-repeat: no-repeat;
background-position: left center;
background-size: 25px 25px;
position: relative;
}
.fn li:first-child, .fn li:last-child {
padding-top: 10px;
}
答案 1 :(得分:1)
你好,只需让你的fn类div固定位置,然后将你的max-height扩展到55 px
这里是jsfiddel = http://jsfiddle.net/mcwo8qvz/2/
.fn {
width: 100%;
height: 100%;
max-height: 55px;
bottom: 0;
left: 0;
position: fixed;
background-color: #fff;
}