1

Подскажите пожалуйста, как мне приподнять блок с телефоном и кнопкой, я пробовал через margin-top: -46. Но уверен, что так неправильно и вряд ли это правильно. Вот код:

*{
    box-sizing: border-box;
 
}
 
body{
    font-family: 'Roboto Slab', serif;
}
 
.clearfix:after {
    content:'';
    display: table;
    width: 100%;
}
 
.container{
    width: 1230px;
    margin: 0 auto;
}
 
#header{
    background: #fff;
    color: #000;
    margin-bottom: 20px;
}
 
.wrapper__logo{
    padding-top: 11px;  
    float: left;
    margin-right: 51px;
}
 
.wrapper__navbar{
    padding: 0px;
    margin: 0px;
}
 
.wrapper__menu{
    float: left;
    margin: 42px 18px 0px 0px;
    display: block;
}
 
.wrapper__menu a {
    color: #000;
    font-weight: bold;
    text-decoration: none;
}
 
.wrapper__menu a:hover{
    height: 37px;
    width: 172px;
    border-radius: 3px;
    background: #f7f2fe;
}
 
.wrapper__phone{
    margin-top: -46px;
    font-weight: bold;
    font-size: 21px;
    float: right;
    color: #2f1059;
}
 
.wrapper__phone a {
    margin-top: 12px;
    float: right;
    border: 1px solid #2f1059;
    border-radius: 7px;
    text-decoration: none;
    font-weight: bold;
    font-size: 14px;
    color: #2f1059;
    padding: 12px 4px 13px 30px;
}
    <section id="header" class="clearfix">
        <div class="container">
            <div class="wrapper">
                <div class="wrapper__logo">
                    <img src="img/logo.png" alt="logo">
                </div>
                <div class="wrapper__navbar">
                    <ul>
                        <li class="wrapper__menu">
                            <a href="#">
                                Инфраструктура
                            </a>
                        </li>
                        <li class="wrapper__menu">
                            <a href="#">
                                Планировки и цены
                            </a>
                        </li>
                        <li class="wrapper__menu">
                            <a href="#">
                                Материалы и отделка
                            </a>
                        </li>
                        <li class="wrapper__menu">
                            <a href="#">
                                Документы
                            </a>
                        </li>
                        <li class="wrapper__menu">
                            <a href="#">
                                Контакты
                            </a>
                        </li>
                    </ul>
                </div>
                <div class="wrapper__phone">
                    <p>+7 (495) 544-23-12</p>
                    <a href="#">
                        Заказать звонок
                    </a>    
                </div>
            </div>
        </div>
    </section>

введите сюда описание изображения

2 ответа 2

1

Используйте position: relative;

*{
    box-sizing: border-box;
 
}
 
body{
    font-family: 'Roboto Slab', serif;
}
 
.clearfix:after {
    content:'';
    display: table;
    width: 100%;
}
 
.container{
    width: 1230px;
    margin: 0 auto;
}
 
#header{
    background: #fff;
    color: #000;
    margin-bottom: 20px;
}
 
.wrapper__logo{
    padding-top: 11px;  
    float: left;
    margin-right: 51px;
}
 
.wrapper__navbar{
    padding: 0px;
    margin: 0px;
}
 
.wrapper__menu{
    float: left;
    margin: 42px 18px 0px 0px;
    display: block;
}
 
.wrapper__menu a {
    color: #000;
    font-weight: bold;
    text-decoration: none;
}
 
.wrapper__menu a:hover{
    height: 37px;
    width: 172px;
    border-radius: 3px;
    background: #f7f2fe;
}
 
.wrapper__phone{
    position: relative;
    bottom: 30px;
    font-weight: bold;
    font-size: 21px;
    float: right;
    color: #2f1059;
}
 
.wrapper__phone a {
    margin-top: 12px;
    float: right;
    border: 1px solid #2f1059;
    border-radius: 7px;
    text-decoration: none;
    font-weight: bold;
    font-size: 14px;
    color: #2f1059;
    padding: 12px 4px 13px 30px;
}
    <section id="header" class="clearfix">
        <div class="container">
            <div class="wrapper">
                <div class="wrapper__logo">
                    <img src="img/logo.png" alt="logo">
                </div>
                <div class="wrapper__navbar">
                    <ul>
                        <li class="wrapper__menu">
                            <a href="#">
                                Инфраструктура
                            </a>
                        </li>
                        <li class="wrapper__menu">
                            <a href="#">
                                Планировки и цены
                            </a>
                        </li>
                        <li class="wrapper__menu">
                            <a href="#">
                                Материалы и отделка
                            </a>
                        </li>
                        <li class="wrapper__menu">
                            <a href="#">
                                Документы
                            </a>
                        </li>
                        <li class="wrapper__menu">
                            <a href="#">
                                Контакты
                            </a>
                        </li>
                    </ul>
                </div>
                <div class="wrapper__phone">
                    <p>+7 (495) 544-23-12</p>
                    <a href="#">
                        Заказать звонок
                    </a>    
                </div>
            </div>
        </div>
    </section>

1

* {
  box-sizing: border-box;
}

body {
  font-family: 'Roboto Slab', serif;
}

.clearfix:after {
  content: '';
  display: table;
  width: 100%;
}

.container {
  width: 1230px;
  margin: 0 auto;
}

#header {
  background: #fff;
  color: #000;
  margin-bottom: 20px;
}

.wrapper__logo {
  padding-top: 11px;
  float: left;
  margin-right: 51px;
}

.wrapper__navbar {
  padding: 0px;
  margin: 0px;
}

.wrapper__menu {
  float: left;
  margin: 42px 18px 0px 0px;
  display: block;
}

.wrapper__menu a {
  color: #000;
  font-weight: bold;
  text-decoration: none;
}

.wrapper__menu a:hover {
  height: 37px;
  width: 172px;
  border-radius: 3px;
  background: #f7f2fe;
}

.wrapper__phone {
  margin-top: -46px;
  font-weight: bold;
  font-size: 21px;
  float: right;
  color: #2f1059;
}

.wrapper__phone a {
  margin-top: 12px;
  float: right;
  border: 1px solid #2f1059;
  border-radius: 7px;
  text-decoration: none;
  font-weight: bold;
  font-size: 14px;
  color: #2f1059;
  padding: 12px 4px 13px 30px;
}

.header__contacts {
  float: right;
  padding-top: 17px;
}

.contacts__phone {
  display: block;
  font-size: 21px;
  font-weight: bold;
  color: #2f1059;
  margin: 0;
  margin-bottom: 5px;
}

.contacts__button {
  display: inline-block;
  text-decoration: none;
  border: 1px solid #2f1059;
  border-radius: 7px;
  padding: 8px 10px;
  margin: 0;
  color: #2f1059;
  text-align: center;
  float: right;
}

.contacts__icon {
  background-image: url(http://preview.ibb.co/dE8do7/phone.png);
  background-size: 16px 16px;
  display: inline-block;
  vertical-align: middle;
  width: 16px;
  height: 16px;
}
<section id="header" class="clearfix">
  <div class="container">
    <div class="wrapper">
      <div class="wrapper__logo">
        <img src="img/logo.png" alt="logo">
      </div>

      <div class="wrapper__navbar">
        <ul>
          <li class="wrapper__menu">
            <a href="#">
                                Инфраструктура
                            </a>
          </li>
          <li class="wrapper__menu">
            <a href="#">
                                Планировки и цены
                            </a>
          </li>
          <li class="wrapper__menu">
            <a href="#">
                                Материалы и отделка
                            </a>
          </li>
          <li class="wrapper__menu">
            <a href="#">
                                Документы
                            </a>
          </li>
          <li class="wrapper__menu">
            <a href="#">
                                Контакты
                            </a>
          </li>
        </ul>
      </div>

      <div class="header__contacts">
        <div class="contacts clearfix">
          <p class="contacts__phone">+7 (495) 544-23-12</p>
          <a href="#" class="contacts__button">
            <i class="contacts__icon">
                      
                    </i>
            <span class="contacts__text">Заказать звонок</span>
          </a>
        </div>
      </div>

    </div>
  </div>
</section>

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.