2015-06-06 54 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?

相關問題