How to make a header responsive?

喜欢而已 提交于 2019-12-12 02:56:43

问题


I am having the following HTML:

<div class='layout-wrap'>
  <div class='mod-header'>
    <a class='logo' href="#"></a>
    <nav>
      <a class="action" href="#">Join now</a>
      <ul class="tour">
        <li><a href="#">item 1</a></li>
        <li><a href="#">item 2</a></li>
        <li><a href="#">item 3</a></li>
      </ul>
      <ul class="search">
        <li><a class="find" href="#">search</a></li>
      </ul>
    </nav>
  </div>
</div>

See also:

http://jsfiddle.net/mulderp/fZ8cW/

And CSS:

.logo {
    text-indent: -9999px;
    float: left;
    width: 16rem;
}

nav {
   float: right;
   display: block;
}

.mod-header nav a {
   float: left;
}

What is a minimum responsive layout solution (e.g. with Susy) such that:

  • a.logo is always visible (also for small screens)
  • a.action is always visible (also for small screens)
  • a.find is always visible
  • ul.tour is hidden for small screens

Not sure if this easily possible, but it would be helpful to know if yes.

Edit:

Narrower question: How to prevent the break in nav of the right part for small questions, and hide the ul.tour ?

Susy SASS:

.mod-header
  @include container
  clear: both
  border: 2px red solid
  +rem('height', 70px)

  .logo
    text-indent: -9999px
    float: left
    +rem('width', 120px)
    +rem('height', 29px)
    +rem('margin', 20px 0)
    border: 2px blue solid
    +data-uri-bg('logo.png')

  nav
    @include span-columns(4,12)
    border: 2px blue solid
    float: right
    +rem('margin', 20px 0)
    +rem('height', 29px)

    ul
      li
        float: left
        +rem('margin', 0 8px)

来源:https://stackoverflow.com/questions/16048134/how-to-make-a-header-responsive

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!