简体   繁体   English

在手机和iPad上使用引导导航栏

[英]with bootstrap navbar on mobile & ipad

I've been trying to get my site to work on mobile and iphone 5 (works fine on iphone 6). 我一直在尝试让我的网站在移动设备和iPhone 5上正常工作(在iPhone 6上正常工作)。 it works on the emulator but on the server it doesn't. 它可以在模拟器上运行,但不能在服务器上运行。 I'm getting a margin of some 20px to my right. 我的右边距为20px。

it works fine on the web : anandandakhil.me 它可以在网上正常运行anandandakhil.me

I looked up some threads here on stackoverflow but they didnt work. 我在这里在stackoverflow上查找了一些线程,但是它们没有起作用。

one of them was @media(max-width:768px) 其中之一是@media(max-width:768px)

i tried attaching it to the class navbar , navbar-collapse 我尝试将其附加到类navbar,navbar-collapse

here's the code 这是代码

index.html 的index.html

Toggle navigation 切换导航
  • Home
  • About 关于
  • Portfolio 投资组合
  • Get in Touch 保持联系
  • style.css style.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; } } 

    I am using Bootstrap as well. 我也在使用Bootstrap。

    As far as I know, the screen resolution of a mobile phone is different than its css resolution. 据我所知,手机的屏幕分辨率与CSS分辨率不同。 For example iPhone 5 has a screen resolution of 640x1136, but the css resolution is 320x568. 例如,iPhone 5的屏幕分辨率为640x1136,而CSS分辨率为320x568。

    声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

     
    粤ICP备18138465号  © 2020-2024 STACKOOM.COM