有以下代码:
footer {
width: auto;
background-color: #444;
padding: 10px;
}
.footer {
position: relative;
overflow: hidden;
height: 70px;
}
.footer ul {
list-style-type: none;
margin: 0;
padding: 0;
position: relative;
left: 50%;
float: left;
height: 70px;
}
.footer ul li {
position: relative;
left: -50%;
float: left;
margin: 0 40px;
}
.footer ul li a {
color: white;
text-decoration: none;
line-height: 70px;
font-family: 'Nunito', sans-serif;
transition: color 0.3s ease-out;
text-transform: uppercase;
font-size: 16px;
}
.footer ul li a:hover {
color: #15C3DB;
}
.rightsFooter {
display: block;
text-align: center;
color: white;
font-family: 'Nunito', sans-serif;
padding-top: 10px;
font-size: 16px;
}
/* from 641px to 833px */
@media (min-width: 641px) and (max-width: 833px) {
.footer ul li a {
font-size: 13px;
}
.rightsFooter {
font-size: 13px;
}
}
/* from 401px to 640px */
@media (min-width: 401px) and (max-width: 640px) {
.footer {
padding-bottom: 57%;
}
.footer ul li {
float: none;
text-align: center;
}
.footer ul li a {
font-size: 13px;
}
.rightsFooter {
font-size: 13px;
}
}
<footer>
<div class="footer">
<ul>
<li><a href="#">contact</a></li>
<li><a href="#">faq</a></li>
<li><a href="#">story</a></li>
<li><a href="#">charity</a></li>
<li><a href="#">shop</a></li>
</ul>
</div>
<p class="rightsFooter">© 2018 BlazRobar. All Rights Reserved</p>
</footer>
在 640 像素ul
处,它呈现水平形状,但随着屏幕进一步缩小,它会滑到下方<p class="rightsFooter">© 2018 BlazRobar. All Rights Reserved</p>
如何解决?
解决方案
flex
:解决方案
inline-block
: