2017-07-26 49 views
1

我的頁腳背景只是消失在768px和它打破了所有的造型由於我的頭碼這個媒體查詢:衝突的CSS頁眉/頁腳

[type="checkbox"], label { 
    display: none; 
} 

@media screen and (max-width: 768px) { 
    nav ul { 
     display: none; 
    } 

我怎樣才能解決這個問題呢? 我嘗試使用多個瀏覽器,頁腳只能在小於768px的範圍內工作。

/* ----------------------------- Footer ------------------------------ */ 

@import url(https://fonts.googleapis.com/css?family=Open+Sans:400,700,300); 

footer { background-color:#0c1a1e; min-height:350px; font-family: 'Open Sans', sans-serif; } 
.footerleft { margin-top:50px; padding:0 36px; } 
.logofooter { margin-bottom:10px; font-size:25px; color:#fff; font-weight:700;} 

.footerleft p { color:#fff; font-size:12px !important; font-family: 'Open Sans', sans-serif; margin-bottom:15px;} 
.footerleft p i { width:20px; color:#999;} 


.paddingtop-bottom { margin-top:50px;} 
.footer-ul { list-style-type:none; padding-left:0px; margin-left:2px;} 
.footer-ul li { line-height:29px; font-size:12px;} 
.footer-ul li a { color:#a0a3a4; transition: color 0.2s linear 0s, background 0.2s linear 0s; } 
.footer-ul i { margin-right:10px;} 
.footer-ul li a:hover {transition: color 0.2s linear 0s, background 0.2s linear 0s; color:#ff670f; } 

.social:hover { 
    -webkit-transform: scale(1.1); 
    -moz-transform: scale(1.1); 
    -o-transform: scale(1.1); 
} 

.icon-ul { list-style-type:none !important; margin:0px; padding:0px;} 
.icon-ul li { line-height:75px; width:100%; float:left;} 
.icon { float:left; margin-right:5px;} 


.copyright { min-height:40px; background-color:#000000;} 
.copyright p { text-align:left; color:#FFF; padding:10px 0; margin-bottom:0px;} 
.heading7 { font-size:21px; font-weight:700; color:#d9d6d6; margin-bottom:22px;} 
.post p { font-size:12px; color:#FFF; line-height:20px;} 
.post p span { display:block; color:#8f8f8f;} 
.bottom_ul { list-style-type:none; float:right; margin-bottom:0px;} 
.bottom_ul li { float:left; line-height:40px;} 
.bottom_ul li:after { content:"/"; color:#FFF; margin-right:8px; margin-left:8px;} 
.bottom_ul li a { color:#FFF; font-size:12px;} 

我用瓶的後端,所以這裏是我的html與神社模板塊:

<header> 
    <div class="inner"> 
    <nav> 
     <a href="{{ url_for('home_page') }}" class="logo">My App Logo.</a> 
     <input type="checkbox" id="nav" /><label for="nav"></label> 
     <ul> 
     <li><a href="{{ url_for('home_page') }}">Home</a></li>  
     <li><a href="{{ url_for('user_page') }}">Dashboard</a></li> 
     <li><a href="{{ url_for('trends') }}">Trends</a></li> 
     <li><a href="{{ url_for('pricing') }}">Pricing</a></li> 
     {% if current_user.is_authenticated %} 
     <li><a href="{{ url_for('user_profile_page') }}"> 
     {{ current_user.first_name or current_user.user_auth.username }}</a></li> 
     <li><a href="{{ url_for('user.logout') }}">Sign out</a></li> 
     {% else %} 
     <li><a href="{{ url_for('user.login') }}">Sign in</a></li> 
     {% endif %} 
     </ul> 
    </nav> 
    </div> 
</header>   

<body> 
{% block body %} 


<footer> 
{% block footer %} 
    <div class="pull-left"><a href="#">Privacy Policy</a> | <a href="#">Terms Of Service</a></div> 
    <div class="pull-right">&copy; 2017 All rights reserved.</div> 

     <div class="container"> 
    <div class="row"> 
     <div class="col-md-4 col-sm-6 footerleft "> 
     <div class="logofooter"> Logo</div> 
     <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley.</p> 
     <p><i class="fa fa-map-pin"></i> 254, Fake Adress, California</p> 
     <p><i class="fa fa-phone"></i> Phone (India) : +54 6846 887</p> 
     <p><i class="fa fa-envelope"></i> E-mail : [email protected]</p> 

     </div> 
     <div class="col-md-2 col-sm-6 paddingtop-bottom"> 
     <h6 class="heading7">GENERAL LINKS</h6> 
     <ul class="footer-ul"> 
      <li><a href="#"> Career</a></li> 
      <li><a href="#"> Privacy Policy</a></li> 
      <li><a href="#"> Terms & Conditions</a></li> 
      <li><a href="#"> Client Gateway</a></li> 
      <li><a href="#"> Ranking</a></li> 
      <li><a href="#"> Case Studies</a></li> 
      <li><a href="#"> Frequently Ask Questions</a></li> 
     </ul> 
     </div> 
     <div class="col-md-3 col-sm-6 paddingtop-bottom"> 
     <h6 class="heading7">LATEST POST</h6> 
     <div class="post"> 
      <p>facebook crack the movie advertisment code:what it means for you <span>August 3,2015</span></p> 
      <p>facebook crack the movie advertisment code:what it means for you <span>August 3,2015</span></p> 
      <p>facebook crack the movie advertisment code:what it means for you <span>August 3,2015</span></p> 
     </div> 
     </div> 
     <div class="col-md-3 col-sm-6 paddingtop-bottom"> 
     <div class="fb-page" data-href="https://www.facebook.com/facebook" data-tabs="timeline" data-height="300" data-small-header="false" style="margin-bottom:15px;" data-adapt-container-width="true" data-hide-cover="false" data-show-facepile="true"> 
      <div class="fb-xfbml-parse-ignore"> 
      <blockquote cite="https://www.facebook.com/facebook"><a href="https://www.facebook.com/facebook">Facebook</a></blockquote> 
      </div> 
     </div> 
     </div> 
    </div> 
    </div> 
{% endblock %} 
</footer> 

<div class="copyright"> 
    <div class="container"> 
    <div class="col-md-6"> 
     <p>© 2016 - All Rights with Webenlance</p> 
    </div> 
    <div class="col-md-6"> 
     <ul class="bottom_ul"> 
     <li><a href="#">Lorem</a></li> 
     <li><a href="#">About us</a></li> 
     <li><a href="#">Blog</a></li> 
     <li><a href="#">Faq's</a></li> 
     <li><a href="#">Contact us</a></li> 
     <li><a href="#">Site Map</a></li> 
     </ul> 
    </div> 
    </div> 
</div> 
+0

你能告訴我們你的HTML的示意圖。 ***不要***所有的,只是結構方面,我們需要知道你是什麼問題。 – Martin

+0

很難說沒有看到標記,但是你可能需要更具體的目標頭部'nav',因爲你的頁腳中可能有另外一個'nav'元素正在從媒體查詢中消失。 – trevorp

回答

1

在您發佈無關與頁腳媒體查詢的CSS ...但我有一個想法:你張貼了這個...

@media screen and (max-width: 768px) { 
    nav ul { 
    display: none; 
} 

...並寫道,這是在你的頭文件代碼中 - 不管是什麼意思(在style標籤內?)

但是,在我剛發佈的代碼中,缺少媒體查詢的大括號。因此,關閉此 - 它可能是你的問題的原因:

@media screen and (max-width: 768px) { 
    nav ul { 
    display: none; 
    } 
} 
0

由於@media查詢行設置最大寬度到768px,這意味着頁腳不會超過最大寬度。嘗試改變這個值,看看會發生什麼。

+0

同一問題在不同的分辨率。 – Blacksun

1

試試下面的CSS

@media screen and (max-width: 768px) { 
    #inner > nav > ul { 
     display: none; 
    } 
} 
+0

它的工作,但顯示:沒有不工作的頭導航鏈接。無論分辨率如何,它都保持可見並固定在頂部。謝謝! – Blacksun

+0

@Blacksun請注意並標記爲接受,如果它工作。 – William