2015-06-06 55 views
0

因此,我正在开发一个小型网站http://www.liftlists.com,作为一个夏季项目,目的是为了更好地进行网页设计和编程。一切都很顺利,但设计明智,但我很难将其融入到移动设备中 - 每次都会显示整个网站。我已将.container更改为流畅,由表格更改为响应,但仍不适合移动网页。我使用Bootstrap,jQuery和一些Angular来运行网站。缩放网站以适应手机屏幕

我在这里做错了什么?我看了其他问题,但每个问题似乎都有一个稍微不同的问题。提前感谢!

<head> 
<meta charset="utf-8"> 
<meta http-equiv="X-UA-Compatible" content="IE=edge"> 
<meta name="viewport" content="width=device-width, user-scalable=yes"> 

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> 
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css"> 
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js"></script> 
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.0-rc.1/angular-animate.js"></script> 
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css"> 

<script src="liftscript.js"></script> 
<script src="dropdown.js"></script> 



<style> 

body { 
    background-color: #516774; 
} 

    .container-fluid{ 
     width: 800px; 
     margin: 0 auto; 
     padding-top: 2cm; 

    } 

.large-background { 
     background: url('big_background2.jpg') no-repeat center center fixed; 
    -webkit-background-size: cover; 
    -moz-background-size: cover; 
    -o-background-size: cover; 
    background-size: cover; 

    } 

    .nav_heading { 
     background: #ededed; 
     color: #222; 
     margin: 0px; 
     text-align: center; 
     padding: 10px; 
     margin-bottom: 20px; 
     box-shadow:-1px 1px 1px rgba(0,0,0,0.15); 
     display: none; 

    } 

    .below_heading { 
     display: none; 
    } 

    ul.tabs{ 
     margin: 0px; 
     padding: 0px; 
     list-style: none; 
     box-shadow:-1px 1px 1px rgba(0,0,0,0.15); 
     background: #ededed; 

    } 

    ul.tabs li:hover { 
     background-color: yellow; 
    } 


    ul.tabs li{ 
     background: none; 
     color: #222; 
     display: inline-block; 
     padding: 10px 15px; 
     cursor: pointer; 

    } 

    ul.tabs li.active{ 
     background: rgba(255,255,255,0.90); 
     color: #222; 
    } 

    .tab-content{ 
     display: none; 
     background: #ededed; 
     padding: 5px; 
     box-shadow:-1px 1px 1px rgba(0,0,0,0.15); 
     margin-bottom:70px; 
    } 

    .tab-content.active{ 
     display: inherit; 
    } 

    .info { 
    display: none; 
    background: #ededed; 
    padding: 15px; 
    box-shadow:-1px 1px 1px rgba(0,0,0,0.15); 

} 

    #button-float { 
    float: right; 
} 

    .float { 
    float: right; 
} 
    #inside_nav_heading { 
    display: none; 
    background: #ededed; 
    color: #222; 
    margin: 0px; 
    text-align: center; 
    margin-bottom: 20px; 
    padding-top: 5px; 

} 

    .footer { 
    position: fixed; 
    bottom: 0; 
    padding-top: 10px; 
    width: 100%; 
    height: 40px; 
    background-color: rgb(51, 51, 51); 
    color: white; 
} 

.ig-b- { 

    display: inline-block; 
} 
.ig-b- img { 
    visibility: hidden; 

} 
.ig-b-:hover { 
    background-position: 0 -60px; 
} 

.ig-b-:active { 

    background-position: 0 -120px; 

} 
.ig-b-24 { 

    width: 24px; height: 24px; background: url(http://badges.instagram.com/static/images/ig-badge-sprite-24.png) no-repeat 0 0; 
} 

@media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (min--moz-device-pixel-ratio: 2), only screen and (-o-min-device-pixel-ratio: 2/1), only screen and (min-device-pixel-ratio: 2), only screen and (min-resolution: 192dpi), only screen and (min-resolution: 2dppx) { 

.ig-b-24 { 
    background-image: url(http://badges.instagram.com/static/images/[email protected]); background-size: 60px 178px; 
} 

+0

.container-fluid - remove width 800px;使用最大宽度800px – Dmitriy

回答

2

如果设置.container到一个固定的宽度,也不会适应。

更改此:

.container-fluid{ 
    width: 800px; 
    margin: 0 auto; 
    padding-top: 2cm; 

} 

要这样:

.container-fluid{ 
    width: 100%; 
    max-width: 800px; 
    margin: 0 auto; 
    padding-top: 2cm; 
} 

它会适应屏幕上,直到它达到800像素,那么它不会扩展更多。

+0

伙计们,非常感谢!我非常感谢帮助。 – Skipper

0

我可以看到,您正在为您的前端设计使用twitter引导框架,这使得它非常容易。

只需尝试并使用引导列,即可为设备响应式设计制作。

研究这部分上引导网站(Bootstrap Grids

如果你实现它,你的网站将响应上的所有设备。 :)

0

如果它是一个约束宽度的布局,你能不能只使用前缀.container类,而不是.container-fluid?

相关问题