2014-09-28 07:25


I have a menu bar like this

            <a href="#">Home</a>
            <a href="#">Our Story</a>
            <a href="#">Tools</a>
            <a href="#">Technology</a>
            <a href="#">Pricing</a>
            <a href="#">Contact</a>
            <a href="#">Careers</a>

The CSS is follows

header {
    position: fixed;
    width: 100%;
    height: 65px;
    opacity: 0.8;
    background-color: #fcfcfc;
    border-bottom: 5px solid #53bf6b;
    z-index: 10;

header nav {
    padding-top: 10px;
    text-align: center;

header nav a {
    text-decoration: none;
    font-family: 'Roboto', sans-serif;
    font-weight: 300;
    font-size: 26px;
    padding-right: 20px;
    color: #f35626;
    background-image: -webkit-linear-gradient(92deg, #f35626, #feab3a);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    -webkit-animation: hue 60s infinite linear;

And when the user resizes I want to Nav A to be followed below (align vertically) How can I do this ?

@media only screen and (min-width: 150px) and (max-width: 550px) {
 /* I must set the code to arrange the nav a items here */

What should I do to make the nav a items follow each other vertically when resized ?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答


  • drbae3964 drbae3964 7年前

    Use display block like there:

    @media only screen and (min-width: 150px) and (max-width: 550px) {
        nav a {display: block;}

    Fixed border-bottom version:

    点赞 评论 复制链接分享
  • douhe4336 douhe4336 7年前
    header nav a {
    display: block; /* you can also try position:relative; */
    点赞 评论 复制链接分享