在移动设备和iPad上使用引导导航栏



我一直在尝试让我的网站在移动设备和iPhone 5上运行(在iPhone 6上运行良好(。 它在模拟器上工作,但在服务器上则不能。我的右边有大约 20px 的边距。

它在网络上工作正常:anandandakhil.me

我在堆栈溢出上查找了一些线程,但它们不起作用。

其中之一是@media(max-width:768px)

我尝试将其附加到类导航栏,导航栏折叠

这是代码

索引.html

切换导航
  • 大约
  • 投资 组合
  • 取得联系
  • 风格.css

    #navbar-header.navbar-default {
        font-size: 16px;
        background-color: rgba(255, 255, 255, 1);
        border-bottom-width: 1px;
    }
    #navbar-header.navbar-default .navbar-nav>li>a {
        color: rgba(119, 119, 119, 1);
        background-color: rgba(255, 255, 255, 1);
    }
    #navbar-header.navbar-default .navbar-nav>li>a:hover,
    #navbar-header.navbar-default .navbar-nav>li>a:focus {
        color: #f28500;
        background-color: rgba(255, 255, 255, 1);
    }
    #navbar-header.navbar-default .navbar-nav>.active>a,
    #navbar-header.navbar-default .navbar-nav>.active>a:hover,
    #navbar-header.navbar-default .navbar-nav>.active>a:focus {
        color: #f28500;
        background-color: #fff;
    }
    @media(max-width:768px) {
    #navbar-header.navbar-default .navbar-toggle {
        border-color: #f28500;
    }
    #navbar-header.navbar-default .navbar-toggle:hover,
    #navbar-header.navbar-default .navbar-toggle:focus {
        background-color: #ffffff;
    }
    #navbar-header.navbar-default .navbar-toggle .icon-bar {
        background-color: #f28500;
    }
    #navbar-header.navbar-default .navbar-toggle:hover .icon-bar,
    #navbar-header.navbar-default .navbar-toggle:focus .icon-bar {
        background-color: #f28500;
    }
    }
    

    我也在使用Bootstrap。

    我所知,手机的屏幕分辨率与其css分辨率不同。例如,iPhone 5的屏幕分辨率为640x1136,但css分辨率为320x568。

    最新更新