Как сохранить элементы div внизу страницы

У меня есть элемент div с двумя столбцами, который мне нужно разместить внизу страницы, чтобы он служил нижним колонтитулом. Проблема в том, что я пытался использовать position:fixed и bottom:0, чтобы элемент отображался внизу. Это работает, но только опускает один из элементов #column вниз, а другой исчезает. Буду признателен за любую помощь.

Код:

/* ~ Copyright (c) Macleay Netball Association (made by Tom Carpenter for Year 11 IPT Assessment Task #2.) 2019. */

html>body {
  background: none;
  padding: 0;
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family: 'Trebuchet MS', sans-serif;
  /* Trebuchet MS as main font throughout website, sans-serif acting as a backup */
}

#wrapper {
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  overflow: hidden;
  position: absolute;
  background: #1B315E;
}

::-webkit-scrollbar {
  display: none;
}

* {
  box-sizing: border-box;
  /* Alignment of DropDown Navigation Menu and Slideshow */
}

.navigation {
  background: #444;
  overflow: hidden;
  top: 0;
}

.menuDropDown {
  overflow: hidden;
  float: left;
}

.menuDropDown>#menuButton {
  font-size: 12px;
  padding: 16px 16px;
  /* Will result in final height of navigation */
  margin: 0;
  outline: none;
  border: none;
  font: inherit;
  background: inherit;
  color: #FFF;
}

#menuButton:hover,
.navigation>.menuDropDown:hover>#menuButton {
  border: none;
  outline: none;
  background: #666;
  color: #1B315E;
}

.menuDropDown:hover>.menuContent {
  display: block;
}

.menuContent {
  display: none;
  position: absolute;
  background: none;
  width: 100%;
  left: 0;
  max-height: 85vh;
  overflow: auto;
  box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
  z-index: 1;
}

.menuRow:after {
  display: table;
  clear: both;
  content: "";
}

.menuColumn {
  width: 25%;
  height: 100px;
  overflow-y: auto;
  padding: 5px;
  float: left;
  background: #666;
}

.menuColumn>a {
  float: none;
  display: block;
  text-align: left;
  text-decoration: none;
  font-size: 14px;
  padding: 8px;
  color: #1B315E;
}

.menuColumn>a.current {
  background: #777;
}

.menuColumn>a:hover {
  background: #888;
}

.logo {
  float: right;
  padding-right: 10px;
  width: 60px;
  height: 50px;
}

.main {
  width: 100%;
  height: calc(100vh - 43px);
  float: left;
  background: none;
  position: absolute;
  overflow: auto;
  padding: 8px;
}

.mainHeader {
  color: #FFF;
  text-align: center;
}

.mainImg {
  display: block;
  margin-left: auto;
  margin-right: auto;
  width: 50%;
}

.mainBody {
  color: #FFF;
  padding: 8px;
}

.row:after {
  content: "";
  clear: both;
  display: table;
}

.column {
  float: left;
  width: 33.33%;
  padding: 8px;
}

#column {
  float: left;
  width: 50%;
  padding: 8px;
  background: #888;
  bottom: 0;
}

.sponsers {
  float: left;
  width: 20%;
  padding: 8px;
  -webkit-filter: grayscale(100%);
  filter: grayscale(100%);
}

.sponsers:hover {
  -webkit-filter: grayscale(80%);
  filter: grayscale(80%);
}

.slideshow {
  /* Slideshow Container containing Images, Sliders and Captions */
  position: relative;
  margin: auto;
  max-width: 1000px;
}

.slides {
  display: none;
}

.slideshowImages {
  width: 100%;
}

.slideButton {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  -ms-transform: translate(-50%, -50%);
  background: #888;
  color: #FFF;
  border: none;
  cursor: pointer;
  padding: 16px 32px;
  font-size: 18px;
  text-align: center;
  border-radius: 10px;
  font-weight: bold;
}

.mnaHeader {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  -ms-transform: translate(-50%, -50%);
}

.slideButton:hover {
  background: #666;
}

.previous,
.next {
  cursor: pointer;
  position: absolute;
  top: 50%;
  width: auto;
  margin-top: -22px;
  padding: 16px;
  color: #FFF;
  font-weight: bold;
  font-size: 18px;
  transition: 0.3s ease;
  border-radius: 0 3px 3px 0;
  user-select: none;
}

.next {
  right: 0;
  border-radius: 3px 0 0 3px;
}

.previous:hover,
.next:hover {
  background: rgba(0, 0, 0, 0.8);
}

table {
  width: 100%;
  font-size: 16px;
  color: #FFF;
}

.tableCaption {
  font-weight: bold;
  font-size: 18px;
  color: #33CC33;
}

table,
th,
td {
  border-collapse: collapse;
  border: 2px solid #888;
}

th,
td {
  padding: 8px;
  text-align: left;
}

#headerTable {
  width: 33.33%;
  background: #888;
  font-size: 18px;
  color: #33CC33;
}

.linkProp {
  color: #FFF;
  text-decoration: underline;
}

.newsPanel {
  width: 100%;
  background: #888;
  height: 135px;
}

.imgNewsPreview {
  width: 215px;
  height: 135px;
  padding: 4px;
  float: left;
}

.newsHeaderPreview {
  color: #FFF;
  margin-top: 0px;
}

.newsBodyPreview {
  color: #FFF;
  margin-top: -12px;
}

.caption {
  color: #33CC33;
  text-align: center;
  position: absolute;
  font-size: 20px;
  width: 100%;
  padding: 8px 12px;
  bottom: 16px;
}

.collapsible {
  background: #888;
  color: #FFF;
  font-weight: bold;
  width: 100%;
  padding: 18px;
  cursor: pointer;
  font-size: 16px;
  outline: none;
  border: none;
  text-align: left;
}

.active,
.collapsible:hover {
  background: #666;
}

.collapsible:after {
  content: '\002B';
  color: #FFF;
  font-weight: bold;
  float: right;
  margin-left: 4px;
}

.active:after {
  content: '\2212';
}

.contentCollapsible {
  padding: 0px 18px;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.2s ease-out;
  background: #F8F8F8;
}

.fade {
  -webkit-animation-name: fade;
  /* To work on Safari (Apple) */
  -webkit-animation-duration: 1s;
  /* To work on Safari (Apple) */
  animation-name: fade;
  animation-duration: 1s;
}

.buttonReturn {
  position: absolute;
  margin-left: 20px;
  margin-top: 20px;
  background: #888;
  color: #FFF;
  border: none;
  cursor: pointer;
  font-size: 36px;
  text-align: center;
  border-radius: 50%;
  font-weight: bold;
}

.videoProp {
  display: block;
  margin-left: auto;
  margin-right: auto;
  width: 50%;
  height: 400px;
}

@-webkit-keyframes fade {
  from {
    opacity: 0.4
  }
  to {
    opacity: 1
  }
}

@keyframes fade {
  from {
    opacity: 0.4
  }
  to {
    opacity: 1
  }
}

@media screen and (max-width: 600px) {
  /* Stacks navigation menu acting for the site to be responsive */
  .menuColumn {
    width: 100%;
    height: auto;
  }
}

@media screen and (max-width: 800px) {
  /* Stacks Image Header on Top - acting as responsive */
  .column,
  #column {
    width: 100%;
  }
}

@media screen and (max-width: 600px) {
  /* Responsive Sponser Images */
  .sponsers {
    width: 33.33%;
  }
}

@media screen and (max-width: 800px) {
  /* Increases video resolution as screen reduces */
  .videoProp {
    width: 100%;
  }
}

@media screen and (max-width: 600px) {
  /* Reduces font-size as screen resolution lowers */
  .newsBodyPreview {
    font-size: 14px;
  }
}

@media screen and (max-width: 300px) {
  /* Reduces font-sizes within the slideshow <div> */
  .previous,
  .next,
  .caption {
    font-size: 14px;
  }
}
<!DOCTYPE HTML>
<!--
	~ Copyright (c) Macleay Netball Association (made by Tom Carpenter for Year 11 IPT Assessment Task #2.) 2019.
-->
<html lang = "en-AU">

<head>
  <title>Contact Us &#8212; Macleay Netball Association</title>
  <meta charset = "UTF-8">
  <meta name = "viewport" content = "width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0">
  <link rel = "stylesheet" href = "../style.css" type = "text/css">
  <!-- Internal Stylesheet -->
  <link rel = "stylesheet" href = "https://use.fontawesome.com/releases/v5.8.1/css/all.css" integrity = "sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf" crossorigin = "anonymous">
  <!-- External Font Stylesheet -->
  <link rel = "shortcut icon" href = "../Assets/Img/mnaHeader.png">
  <!-- Tab Browser Icon (Favicon) -->
</head>

<body>
  <div id = "wrapper">
    <div class = "navigation">
      <div class = "menuDropDown">
        <button id = "menuButton" title = "Navigation Menu"><i class = "fas fa-bars"></i> Menu</button>
        <div class = "menuContent">
          <div class = "menuRow">
            <div class = "menuColumn">
              <a title = "Home" href = "../index.html"><i class = "fas fa-home"></i> Home</a>
              <a title = "Association Contacts" href = "contacts.html"><i class = "fas fa-address-book"></i> Association Contacts</a>
            </div>
            <div class = "menuColumn">
              <a title = "Weekly Draw" href = "weekly-draw.html"><i class = "fas fa-user-friends"></i> Weekly Draw</a>
              <a title = "News" href = "#"><i class = "far fa-newspaper"></i> News</a>
            </div>
            <div class = "menuColumn">
              <a title = "Quick Links" href = "links.html"><i class = "fas fa-bookmark"></i> Quick Links</a>
              <a title = "Representative Teams" href = "representative-teams.html"><i class = "fas fa-certificate"></i> Representative Teams</a>
            </div>
            <div class = "menuColumn">
              <a title = "Documentation" href = "documentation.html"><i class = "fas fa-file"></i> Documentation</a>
              <a class = "current" title = "Contact Us" href = "contact-us.html"><i class = "fas fa-phone"></i> Contact Us</a>
            </div>
          </div>
        </div>
      </div>
      <a href = "../index.html"><img src = "../Assets/Img/mnaHeader.png" alt = "Macleay Netball Association" title = "Macleay Netball Association" class = "logo"></a>
      <!-- Macleay Netball Association Main Logo -->
    </div>
    <!-- End of Navigation -->
    <div class = "main">
      <iframe src = "https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3417.0548484369647!2d152.83521681537312!3d-31.080401281517187!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x6b9ddf84d6da904b%3A0xfc941d1ded8f7a25!2sPam+Guyer+Netball+Centre!5e0!3m2!1sen!2sau!4v1559129788713!5m2!1sen!2sau"
        width = "100%" height = "400px" frameborder = "0" style = "border:0" allowfullscreen></iframe>
      <!-- Google Maps Embed -->
      <br>

      <div class = "row">
        <div id = "column">1</div>
        <div id = "column">2</div>
      </div>
      <!-- End of Footer -->
    </div>
    <!-- End of Main -->
  </div>
  <!-- End of Wrapper -->
</body>

</html>

Прикреплены некоторые изображения, если я добавлю position:fixedbottom:0 в #column код CSS. Только столбец 2 опускается, 1 скрыт.

Как сохранить элементы div внизу страницы

Вы не можете использовать один и тот же идентификатор дважды. Измените на class = "footer", соответствующим образом настройте CSS.

bluemoon6790 29.05.2019 14:29

Это не сработало.

tcarpenter17 29.05.2019 14:36

@ bluemoon6790 Вы можете использовать только CSS. Только JS не работает с несколькими id-атрибутами, имеющими одинаковое значение

yunzen 29.05.2019 14:38
Улучшение производительности загрузки с помощью Google Tag Manager и атрибута Defer
Улучшение производительности загрузки с помощью Google Tag Manager и атрибута Defer
В настоящее время производительность загрузки веб-сайта имеет решающее значение не только для удобства пользователей, но и для ранжирования в...
Введение в CSS
Введение в CSS
CSS является неотъемлемой частью трех основных составляющих front-end веб-разработки.
Как выровнять Div по центру?
Как выровнять Div по центру?
Чтобы выровнять элемент <div>по горизонтали и вертикали с помощью CSS, можно использовать комбинацию свойств и значений CSS. Вот несколько методов,...
Навигация по приложениям React: Исчерпывающее руководство по React Router
Навигация по приложениям React: Исчерпывающее руководство по React Router
React Router стала незаменимой библиотекой для создания одностраничных приложений с навигацией в React. В этой статье блога мы подробно рассмотрим...
Система управления парковками с использованием HTML, CSS и JavaScript
Система управления парковками с использованием HTML, CSS и JavaScript
Веб-сайт по управлению парковками был создан с использованием HTML, CSS и JavaScript. Это простой сайт, ничего вычурного. Основная цель -...
Toor - Ангулярный шаблон для бронирования путешествий
Toor - Ангулярный шаблон для бронирования путешествий
Toor - Travel Booking Angular Template один из лучших Travel & Tour booking template in the world. 30+ валидированных HTML5 страниц, которые помогут...
0
3
137
4
Перейти к ответу Данный вопрос помечен как решенный

Ответы 4

Добавьте идентификатор к элементу, который вы хотите использовать в качестве нижнего колонтитула, удалите класс и используйте приведенный ниже css для стилизации элемента.

#footer {
clear: both;
}
<div id = "footer">
<div id = "column">1</div>
<div id = "column">2</div>
</div> <!-- End of Footer -->

И 1, и 2 прикреплены к низу. Только float: left здесь не действует, и они находятся в одном и том же месте. 2 находится перед 1, а последний не виден за 2

Сделайте это вместо этого.

<div class = "row footer">
  <div id = "column">1</div>
  <div id = "column">2</div>
</div>
.footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
}

/* ~ Copyright (c) Macleay Netball Association (made by Tom Carpenter for Year 11 IPT Assessment Task #2.) 2019. */

html>body {
  background: none;
  padding: 0;
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family: 'Trebuchet MS', sans-serif;
  /* Trebuchet MS as main font throughout website, sans-serif acting as a backup */
}

#wrapper {
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  overflow: hidden;
  position: absolute;
  background: #1B315E;
}

::-webkit-scrollbar {
  display: none;
}

* {
  box-sizing: border-box;
  /* Alignment of DropDown Navigation Menu and Slideshow */
}

.navigation {
  background: #444;
  overflow: hidden;
  top: 0;
}

.menuDropDown {
  overflow: hidden;
  float: left;
}

.menuDropDown>#menuButton {
  font-size: 12px;
  padding: 16px 16px;
  /* Will result in final height of navigation */
  margin: 0;
  outline: none;
  border: none;
  font: inherit;
  background: inherit;
  color: #FFF;
}

#menuButton:hover,
.navigation>.menuDropDown:hover>#menuButton {
  border: none;
  outline: none;
  background: #666;
  color: #1B315E;
}

.menuDropDown:hover>.menuContent {
  display: block;
}

.menuContent {
  display: none;
  position: absolute;
  background: none;
  width: 100%;
  left: 0;
  max-height: 85vh;
  overflow: auto;
  box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
  z-index: 1;
}

.menuRow:after {
  display: table;
  clear: both;
  content: "";
}

.menuColumn {
  width: 25%;
  height: 100px;
  overflow-y: auto;
  padding: 5px;
  float: left;
  background: #666;
}

.menuColumn>a {
  float: none;
  display: block;
  text-align: left;
  text-decoration: none;
  font-size: 14px;
  padding: 8px;
  color: #1B315E;
}

.menuColumn>a.current {
  background: #777;
}

.menuColumn>a:hover {
  background: #888;
}

.logo {
  float: right;
  padding-right: 10px;
  width: 60px;
  height: 50px;
}

.main {
  width: 100%;
  height: calc(100vh - 43px);
  float: left;
  background: none;
  position: absolute;
  overflow: auto;
  padding: 8px;
}

.mainHeader {
  color: #FFF;
  text-align: center;
}

.mainImg {
  display: block;
  margin-left: auto;
  margin-right: auto;
  width: 50%;
}

.mainBody {
  color: #FFF;
  padding: 8px;
}

.row:after {
  content: "";
  clear: both;
  display: table;
}

.column {
  float: left;
  width: 33.33%;
  padding: 8px;
}

#column {
  float: left;
  width: 50%;
  padding: 8px;
  background: #888;
  bottom: 0;
}

.sponsers {
  float: left;
  width: 20%;
  padding: 8px;
  -webkit-filter: grayscale(100%);
  filter: grayscale(100%);
}

.sponsers:hover {
  -webkit-filter: grayscale(80%);
  filter: grayscale(80%);
}

.slideshow {
  /* Slideshow Container containing Images, Sliders and Captions */
  position: relative;
  margin: auto;
  max-width: 1000px;
}

.slides {
  display: none;
}

.slideshowImages {
  width: 100%;
}

.slideButton {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  -ms-transform: translate(-50%, -50%);
  background: #888;
  color: #FFF;
  border: none;
  cursor: pointer;
  padding: 16px 32px;
  font-size: 18px;
  text-align: center;
  border-radius: 10px;
  font-weight: bold;
}

.mnaHeader {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  -ms-transform: translate(-50%, -50%);
}

.slideButton:hover {
  background: #666;
}

.previous,
.next {
  cursor: pointer;
  position: absolute;
  top: 50%;
  width: auto;
  margin-top: -22px;
  padding: 16px;
  color: #FFF;
  font-weight: bold;
  font-size: 18px;
  transition: 0.3s ease;
  border-radius: 0 3px 3px 0;
  user-select: none;
}

.next {
  right: 0;
  border-radius: 3px 0 0 3px;
}

.previous:hover,
.next:hover {
  background: rgba(0, 0, 0, 0.8);
}

table {
  width: 100%;
  font-size: 16px;
  color: #FFF;
}

.tableCaption {
  font-weight: bold;
  font-size: 18px;
  color: #33CC33;
}

table,
th,
td {
  border-collapse: collapse;
  border: 2px solid #888;
}

th,
td {
  padding: 8px;
  text-align: left;
}

#headerTable {
  width: 33.33%;
  background: #888;
  font-size: 18px;
  color: #33CC33;
}

.linkProp {
  color: #FFF;
  text-decoration: underline;
}

.newsPanel {
  width: 100%;
  background: #888;
  height: 135px;
}

.imgNewsPreview {
  width: 215px;
  height: 135px;
  padding: 4px;
  float: left;
}

.newsHeaderPreview {
  color: #FFF;
  margin-top: 0px;
}

.newsBodyPreview {
  color: #FFF;
  margin-top: -12px;
}

.caption {
  color: #33CC33;
  text-align: center;
  position: absolute;
  font-size: 20px;
  width: 100%;
  padding: 8px 12px;
  bottom: 16px;
}

.collapsible {
  background: #888;
  color: #FFF;
  font-weight: bold;
  width: 100%;
  padding: 18px;
  cursor: pointer;
  font-size: 16px;
  outline: none;
  border: none;
  text-align: left;
}

.active,
.collapsible:hover {
  background: #666;
}

.collapsible:after {
  content: '\002B';
  color: #FFF;
  font-weight: bold;
  float: right;
  margin-left: 4px;
}

.active:after {
  content: '\2212';
}

.contentCollapsible {
  padding: 0px 18px;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.2s ease-out;
  background: #F8F8F8;
}

.fade {
  -webkit-animation-name: fade;
  /* To work on Safari (Apple) */
  -webkit-animation-duration: 1s;
  /* To work on Safari (Apple) */
  animation-name: fade;
  animation-duration: 1s;
}

.buttonReturn {
  position: absolute;
  margin-left: 20px;
  margin-top: 20px;
  background: #888;
  color: #FFF;
  border: none;
  cursor: pointer;
  font-size: 36px;
  text-align: center;
  border-radius: 50%;
  font-weight: bold;
}

.videoProp {
  display: block;
  margin-left: auto;
  margin-right: auto;
  width: 50%;
  height: 400px;
}

.footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
}
@-webkit-keyframes fade {
  from {
    opacity: 0.4
  }
  to {
    opacity: 1
  }
}

@keyframes fade {
  from {
    opacity: 0.4
  }
  to {
    opacity: 1
  }
}

@media screen and (max-width: 600px) {
  /* Stacks navigation menu acting for the site to be responsive */
  .menuColumn {
    width: 100%;
    height: auto;
  }
}

@media screen and (max-width: 800px) {
  /* Stacks Image Header on Top - acting as responsive */
  .column,
  #column {
    width: 100%;
  }
}

@media screen and (max-width: 600px) {
  /* Responsive Sponser Images */
  .sponsers {
    width: 33.33%;
  }
}

@media screen and (max-width: 800px) {
  /* Increases video resolution as screen reduces */
  .videoProp {
    width: 100%;
  }
}

@media screen and (max-width: 600px) {
  /* Reduces font-size as screen resolution lowers */
  .newsBodyPreview {
    font-size: 14px;
  }
}

@media screen and (max-width: 300px) {
  /* Reduces font-sizes within the slideshow <div> */
  .previous,
  .next,
  .caption {
    font-size: 14px;
  }
}
<link rel = "stylesheet" href = "https://use.fontawesome.com/releases/v5.8.1/css/all.css" integrity = "sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf" crossorigin = "anonymous">
<div id = "wrapper">
  <div class = "navigation">
    <div class = "menuDropDown">
      <button id = "menuButton" title = "Navigation Menu"><i class = "fas fa-bars"></i> Menu</button>
      <div class = "menuContent">
        <div class = "menuRow">
          <div class = "menuColumn">
            <a title = "Home" href = "../index.html"><i class = "fas fa-home"></i> Home</a>
            <a title = "Association Contacts" href = "contacts.html"><i class = "fas fa-address-book"></i> Association Contacts</a>
          </div>
          <div class = "menuColumn">
            <a title = "Weekly Draw" href = "weekly-draw.html"><i class = "fas fa-user-friends"></i> Weekly Draw</a>
            <a title = "News" href = "#"><i class = "far fa-newspaper"></i> News</a>
          </div>
          <div class = "menuColumn">
            <a title = "Quick Links" href = "links.html"><i class = "fas fa-bookmark"></i> Quick Links</a>
            <a title = "Representative Teams" href = "representative-teams.html"><i class = "fas fa-certificate"></i> Representative Teams</a>
          </div>
          <div class = "menuColumn">
            <a title = "Documentation" href = "documentation.html"><i class = "fas fa-file"></i> Documentation</a>
            <a class = "current" title = "Contact Us" href = "contact-us.html"><i class = "fas fa-phone"></i> Contact Us</a>
          </div>
        </div>
      </div>
    </div>
    <a href = "../index.html"><img src = "../Assets/Img/mnaHeader.png" alt = "Macleay Netball Association" title = "Macleay Netball Association" class = "logo"></a>
    <!-- Macleay Netball Association Main Logo -->
  </div>
  <!-- End of Navigation -->
  <div class = "main">
    <iframe src = "https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3417.0548484369647!2d152.83521681537312!3d-31.080401281517187!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x6b9ddf84d6da904b%3A0xfc941d1ded8f7a25!2sPam+Guyer+Netball+Centre!5e0!3m2!1sen!2sau!4v1559129788713!5m2!1sen!2sau"
      width = "100%" height = "400px" frameborder = "0" style = "border:0" allowfullscreen></iframe>
    <!-- Google Maps Embed -->
    <br>

    <div class = "row footer">
      <div id = "column">1</div>
      <div id = "column">2</div>
    </div>
    <!-- End of Footer -->
  </div>
  <!-- End of Main -->
</div>
<!-- End of Wrapper -->
Ответ принят как подходящий

Лучший способ добиться этого, имея в виду отзывчивость и простоту манипулирования на разных размерах экрана, — это обернуть два элемента div в другой div, который вы поместите фиксированным внизу, а затем отрегулируйте два div так, чтобы они занимали 50% своего родителя. Вы сделали половину этой работы, поместив div в обертку .row.

Лучшим решением, вероятно, будет использование flex для настройки div в их родительской оболочке следующим образом:

Кроме того, вы не можете использовать один и тот же идентификатор дважды, как в вашем примере.

<div class = "row">
    <div>1</div>
    <div>2</div>
 </div>

<style>
    .row {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;

        display: flex;
    }
    .row > div {
        flex: 1;
    }
</style>

Затем на мобильных устройствах вы можете просто изменить направление гибкости, и нижний колонтитул станет одноколоночным, а не двухколоночным. Так:

<style>
    @media only screen and (max-width: 768px) {
        .row {
            flex-direction: column;
        }
    }
</style>

При реагировании столбцы не будут расширяться на весь экран, ширина: 100% не будет этого делать.

tcarpenter17 29.05.2019 14:53

Какой браузер? Они хорошо расширяются с моей стороны. Попробуйте flex-basis: 100%; заменить ширину в медиа-запросе.

Ivica Pesovski 29.05.2019 15:01

хром, все еще не повезло

tcarpenter17 29.05.2019 15:03

Ааа, я знаю. Вам не хватает метатега окна просмотра, а мобильный симулятор Chrome не может распознавать медиа-запросы. Добавьте это где-нибудь в <head> часть вашего кода: <meta name = "viewport" content = "width=device-width, initial-scale=1">

Ivica Pesovski 29.05.2019 15:10

Не могли бы вы прислать скриншот того, как это выглядит на мобильном устройстве, когда вы его тестируете? Как только я добавил метатег области просмотра, он хорошо выглядит в любом браузере, который я пробовал (как и должно быть в отношении кода). Возможно, у вас есть еще один оставшийся CSS-запрос @media, который что-то делает с теми же элементами, чтобы они оставались встроенными. Вот пример того, как я его настроил: jsfiddle.net/pesovski/8390z6jb/3

Ivica Pesovski 30.05.2019 16:16

Прежде всего, id должен быть уникальным для элемента, не должен устанавливать один и тот же идентификатор для двух элементов.

Когда вы устанавливаете позицию fixed для элемента, он позиционируется относительно области просмотра, а не относительно потока страницы.

Оба ваших элемента имеют bottom: 0, что относится к окну браузера, поэтому ваш первый элемент закрыт вторым (он не скрыт). Вы можете сгруппировать их в одном родительском элементе и расположить родительский элемент, чтобы ваши элементы располагались так, как ожидалось. Взгляните на следующий код:

body {
    min-height: 200vh;
}

#column {
    display: block;
    padding 15px;
    width: 100%;
    position: fixed;
    bottom: 0;
    background: #e5e5e5;
}

#column div {
    display: block;
    padding: 10px;
    width: 100%;
    background: #9b009b;
    color: #fff;
    margin-bottom: 10px;
}
<div id = "column">
    <div>first col</div>
    <div>second col</div>
</div>

Другие вопросы по теме