Не удается центрировать нижний колонтитул веб-страницы и изменять его размер в соответствии с соотношением окон

#html #css

#HTML #css

Вопрос:

Я перепробовал много кодов, и они сработали, но когда я попытался сделать два div рядом для нижнего колонтитула, я не смог его центрировать, и с тех пор я не смог заставить его работать с соотношением окон пользователя, даже после того, как попробовал коды от других, я все еще не могудалось это исправить.

Проблема здесь в том, что я не могу центрировать то, что находится внутри нижнего колонтитула, и все же изменять его в соответствии с соотношением окон пользователя.

 /* Footer */

#sides{
    /*margin-left:750px;*/
}
#left{
    float:left;
    text-align: left;
    overflow:hidden;
}

.footer {
    background-color: black;
    padding: 30px;
    text-align: center;
    color: #99ffdd;
}


.footer-distributed{
    background-color: #2c292f;
    box-sizing: border-box;
    width: 100%;
    text-align: left;
    font: bold 16px sans-serif;
    padding: 50px 50px 60px 50px;
    margin: 0 auto;;
}

.footer-distributed .footer-left,
.footer-distributed .footer-center{
    display: inline-block;
    vertical-align: top;
}

/* Footer left */
.footer-distributed .footer-left{
    width: 14%;
}

/* Footer Center */
.footer-distributed .footer-center p{
    display: inline-block;
    color: #ffffff;
    vertical-align: middle;
    margin:0;
}

.footer-distributed .footer-center p a{
    color:  #e0ac1c;
    text-decoration: none;;
}

@media (max-width: 880px) {

    .footer-distributed .footer-left,
    .footer-distributed .footer-center{
        display: block;
        width: 100%;
        margin-bottom: 40px;
        text-align: center;
    }
    .footer-distributed .footer-center i{
        margin-left: 0;
    }

}  
 <footer class="footer-distributed">
    <div class="footer-left">
        <img style="width: 100px; height: 100px" src="http://localhost/Window_Cleaner/pictures/paypal/paypal_support.png">
    </div>
    <div class="footer-center">
        <a class="contactme" href="http://localhost/Window_Cleaner/menu/contact.html">
            <h2>Contact me</h2>
        </a>
        <div>
            <i class="fa fa-phone"></i>
            <p> 99 99999 999999</p>
        </div>
        <div>
            <i class="fa fa-envelope"></i>
            <p><a href="mailto:example@hotmail.com">example@hotmail.com</a></p>
        </div>
    </div>
</footer>  

Ответ №1:

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

 /* Footer */

#sides {
    /*margin-left:750px;*/
}

#left {
    float: left;
    text-align: left;
    overflow: hidden;
}

.footer {
    background-color: black;
    padding: 30px;
    text-align: center;
    color: #99ffdd;
}

.footer-left {
    position: absolute;
    left: 0;
}

.footer-distributed {
    background-color: #2c292f;
    box-sizing: border-box;
    width: 100%;
    text-align: left;
    font: bold 16px sans-serif;
    display: flex;
    flex-flow: row nowrap;
    justify-content: center;
    position: relative;
}  
 <footer class="footer-distributed">
    <div class="footer-left">
        <img style="width: 100px; height: 100px" src="http://localhost/Window_Cleaner/pictures/paypal/paypal_support.png">
    </div>
    <div class="footer-center">
        <a class="contactme" href="http://localhost/Window_Cleaner/menu/contact.html">
            <h2>Contact me</h2>
        </a>
        <div>
            <i class="fa fa-phone"></i>
            <p> 99 99999 999999</p>
        </div>
        <div>
            <i class="fa fa-envelope"></i>
            <p><a href="mailto:example@hotmail.com">example@hotmail.com</a></p>
        </div>
    </div>
</footer>