【问题标题】:Responsive Web Design: Works in Responsive Mode But Not While Shrinking响应式网页设计:在响应式模式下工作,但在收缩时不行
【发布时间】:2018-02-11 13:28:14
【问题描述】:

首先,我不确定这是一个小错误还是一个奇怪的问题。我正在使用 HTML5、CSS 和一些 Javascript 进行网页设计(前端,无后端)。 我遇到的问题是响应能力。我正在使用 Mozilla Firefox 来测试网页的响应性(响应模式)。

问题:在 Firefox 的响应模式下查看时,WebPage 的响应性工作正常。但是,如果我尝试通过缩小浏览器窗口来测试它,则根本没有响应能力。

我无法弄清楚问题所在。 我正在使用 CSS 媒体查询来实现响应性。 下面给出了一些代码。 在这里查看网页http://www.ammini.edu.in/fetera

@media only screen 
and (min-device-width : 320px) 
and (max-device-width : 480px) {
   nav .title {
        width: 100%;
        text-align: center;
        padding: 10px;
    }
    nav ul {
        width: 100%;
        text-align: center;
        padding: 10px;
        font-size: 14px;
    }

    #del-countdown {
        display: none;
    }
    #boxes {
        width: 100%;
    }
    #boxes .container {
        width: 90%;
        height: auto;
    }
    #boxes .box {
        width: 100%;
        height: auto;
        text-align: center;
        padding: 15px 0px;
        /* border-bottom: solid white 2px; */
    }
        #boxes .box h3{
        width: 100%;
        height: auto;
        text-align: center;
    }
        #boxes .box p{
        width: 100%;
        height: auto;
        text-align: center;
            overflow: hidden;
    }
        #patrons {
        background-color: #333333;
        font-family: Georgia, sans-serif;
    }

    #patrons .container {
        width: 90%;
    }

    #patrons .box {
        width: 100%;
        text-align: center;
        height: auto;
        padding: 15px 0px;
        color: aliceblue;
    }

    #patrons .box img {
        width: 25%;
        height: auto;
        text-align: center;
        /* border-radius: 50%; */
    }

    #patrons a {
        font-weight: 550;
        font-size: 18px;
        text-align: justify;
        text-decoration: none;
        color: aqua;
    }

    #patrons .box p {
        font-family: Georgia, sans-serif;
        font-weight: 550;
        font-size: 18px;
        text-align: center;
    }
    
    .logo {
    display: block;
    width: 80%;
    height: auto;
    }
    
    .events {
    display: grid;
    grid-template-columns: 1fr;
    }
}

@media only screen 
and (min-device-width : 480px) 
and (max-device-width : 768px) {
   nav .title {
        width: 100%;
        text-align: center;
        padding: 10px;
    }
    nav ul {
        width: 100%;
        text-align: center;
        padding: 10px;
        font-size: 14px;
    }
    
    #del-countdown {
        display: none;
    }
    
    #boxes {
        width: 100%;
    }
    #boxes .container {
        width: 90%;
        height: auto;
    }
    #boxes .box {
        width: 100%;
        height: auto;
        text-align: center;
        padding: 15px 0px;
        /* border-bottom: solid white 2px; */
    }
        #boxes .box h3{
        width: 100%;
        height: auto;
        text-align: center;
    }
        #boxes .box p{
        width: 100%;
        height: auto;
        text-align: center;
        overflow: hidden;
    }
    
    
    #patrons {
        background-color: #333333;
        font-family: Georgia, sans-serif;
    }

    #patrons .container {
        width: 90%;
    }

    #patrons .box {
        width: 100%;
        text-align: center;
        height: auto;
        padding: 15px 0px;
        color: aliceblue;
    }

    #patrons .box img {
        width: 25%;
        height: auto;
        text-align: center;
        /* border-radius: 50%; */
    }

    #patrons a {
        font-weight: 550;
        font-size: 18px;
        text-align: justify;
        text-decoration: none;
        color: aqua;
    }

    #patrons .box p {
        font-family: Georgia, sans-serif;
        font-weight: 550;
        font-size: 18px;
        text-align: center;
    }
    .events {
    display: grid;
    grid-template-columns: 1fr ;
    }

}
<section id="patron_div" class="section section-dark">
    <h1 class="title_patron">PATRONS</h1>
    <section id="patrons">
    <div class="container">
        <div class="box" id="box1">
          <img src="./img/principal.png">
            <h3>PATRON</h3>
            <p> Dr.Shashi Dharan<br> Principal, Ammini College of Engineering</p>
        </div>
        <div class="box" id="box2">
          <img src="./img/madhu.png">
          <h3>CHIEF PATRON</h3>
          <p>Mr. K G Madhu<br> Chairman, Ammini College of Engineering</p>
        </div>
        <div class="box" id="box3">
          <img src="./img/hod.png">
          <h3>FEST CO-ORDINATOR</h3>
          <p>Mr. Pradeesh A.R<br> Head of Department, Mechanical Engineering</p>
        </div>
      </div>
      </section>
  </section>

【问题讨论】:

  • 谁能帮帮我.. ?

标签: javascript css html


【解决方案1】:

经过长时间的搜索,我得到了答案。

问题是我已将媒体查询设置为 MAX-DEVICE-WIDTH,而不是针对 MAX-WIDTH 的窗口大小。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-12-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多