Hide footer on mobile and tablet

I want to hide my footer on mobile and tablet devices. I have searched all the help but found nothing. HTML code for my footer,

<!-- Footer -->
    <footer class="footer" role="contentinfo">
        <div class="container<?php echo ($params->get('fluidContainer') ? '-fluid' : ''); ?>">
            <jdoc:include type="modules" name="footer" style="none" />
          <div class="footer">
&copy; <?php echo date('Y'); ?> <?php echo $sitename; ?>
            </div>

      

CSS code for my footer,

.footer {
  background-color: #F6861F;
  color: #fff;
  padding: 20px 0;
  margin-bottom: 0
  text-align: center;
  overflow: hidden;
  width: 100%;
}

      

+3


source to share


5 answers


After the first mobile strategy, you must first hide the footer and then show it only for desktops.



.footer {
  display: none;
}

@media (min-width: 992px) {
  .footer {
    display: block;
    background-color: #F6861F;
    color: #fff;
    padding: 20px 0;
    margin-bottom: 0
    text-align: center;
    overflow: hidden;
    width: 100%;
  }
}

      

+1


source


Something like this should work:



@media screen and (max-width: 600px) {
  .footer{
    visibility: hidden;
    display: none;
  }
}

      

0


source


Check out this jsfiddle http://jsfiddle.net/ks1q8nkt/

@media screen and (max-width: 600px) {
  .footer{
    display: none;
  }
}

      

The code means that every class, id and element that is defined in the block will be responsible for all devices with a maximum width of 600 pixels.

0


source


You need to write @media for this in css for your mobile width.

@media screen and (max-width: 360px) {
 .footer{
     visibility: hidden;
     display: none;
 }
}

      

For small mobile devices and you can change the width according to yours.

0


source


Use CSS from other people. Alternatively, if you are using the Bootstrap framework (baked in most Joomla templates), just add the appropriate column visibility classes:

<!-- Footer -->
<footer class="footer" role="contentinfo">
    <div class="hidden-xs hidden-sm container<?php echo ($params->get('fluidContainer') ? '-fluid' : ''); ?>">
        <jdoc:include type="modules" name="footer" style="none" />
        <div class="footer">
            &copy; <?php echo date('Y'); ?> <?php echo $sitename; ?>
        </div>
    </div>
</footer>

      

I added hidden-xs and hidden-sm to the class list div

in front of the container. See here: Bootstrap Helper Utilities

NOTE. These two classes are from the most recent version of Bootstrap. For version 2.3.2, you should read here: Bootstrap v2.3.2 Responsive Utilities

0


source







All Articles