【问题标题】:How to make my columns stack on top of each other using media quires如何使用媒体查询使我的列相互堆叠
【发布时间】:2018-02-16 10:41:14
【问题描述】:

我正在努力解决这个问题。任何帮助或建议将不胜感激。我的目标是当屏幕小于 700 像素时,内容将从当前的并排列变为块显示。但目前我的专栏只是并排。我设法让它在 jsfiddle 中工作,但不能让它做任何事情,然后在崇高的文本中缩小在一起。

footer {
  background-color: #333538;
  /* padding: 24px 0; */
  margin-top: 12px;
}
footer p {
  color: white;
  margin-bottom: 12px !important;
}
.social {
  list-style-type: none;
  padding: 0;
}
.social li {
  display: inline;
  margin-right: 12px;
}

.copyright {
  /* padding: 12px 0; */
  text-align: center;
}
.column-half {
  margin: 0 12px 24px 12px;
  width: 400px;
  background-color: blue;
  /*float: left;*/
}
.row-foot {
  display: flex;
  flex-direction: row;
  margin: 72px;

}
.container {
  width: 1200px;
  margin: 0 auto;
}
@media (max-width: 700px) {
  .row-foot {
    display: block;
  }
  .container {
    width: auto;
  }
}
<footer>
  <div class="container">
    <div class="row-foot">
      <div class="column-half">
        <h4>BOOK AN APPOINTMENT</h4>
        <p>The Paw Pad is a professioanl dog grooming service based in lytham</p>
        <p>Strit practice to a high hygeine standard ensuring your dog leaves in good health as well as a great coat</p>
        <p>All request are welcome and I'll be happy to help in any way I can</p>
        <p><b>Opening Hours</b></p>
        <p><i>Monday to Friday 10am-5pm</i></p>
      </div> <!-- end column half -->
      <div class="column-half">
        <h4>Get in touch</h4>
        <p>46 aaaaa ddddt</p>
        <p>fy8 gr6</p>
        <p>000000000</p>
        <p><a href="mailto:fdjhgfdhgf@gmail.com">thgfhgfhgs@gmail.com</a></p>
        <li class="social"><a href="#"><img src="C:\Users\Sue\Desktop\sublime-
          text\images/facebook-logo2.png" alt="Facebook"></a></li>
        </div>
      </div>
    </div>
  </footer>

【问题讨论】:

  • 我会使用具有不同 flex-direction(行/列)的 Flexbox:css-tricks.com/snippets/css/a-guide-to-flexbox
  • 请设置为code sn-p
  • 谢谢,我去看看。
  • 成功了!我使用了弹性包装。应该对以后有用。感谢您的提示

标签: html css media-queries block


【解决方案1】:

据我所知,您的 CSS 和 HTML 语法都存在问题。

对于 HTML:

第二个“半列”div 内的 li 元素应该在 ulol 元素内。

做类似的事情

<ul class="social"><li>............type the rest here</li></ul>

对于 CSS:

将 screen 或 all 添加到您的媒体查询声明中,如下所示

@media screen and (max-width: 700px) {}

【讨论】:

  • 感谢 pawel 的编辑。现在看起来好多了。刚刚观察到。原谅我,我是新来的。
  • 欢迎您 peakinho。让我知道它是否解决了它
猜你喜欢
  • 2014-10-19
  • 1970-01-01
  • 1970-01-01
  • 2016-02-25
  • 2021-10-25
  • 2017-08-31
  • 2015-10-10
  • 2017-05-27
  • 1970-01-01
相关资源
最近更新 更多