A
A
Alexander2015-11-13 11:24:25
css
Alexander, 2015-11-13 11:24:25

How to align a horizontal shape to the center?

<div class="content">
        <div class="order">
            <div class="order-content">
                <h1 class="text-center">Умная бухалтерия от "0" рублей! <br>
                    ...финансовая прочность Вашего бизнеса!
                </h1>
                <form action="#">
                    <ul>
                        <li><input type="text"></li>
                        <li><input type="text"></li>
                        <li><button>Заказать</button></li>
                    </ul>
                </form>
            </div>
        </div>
    </div>

LESS:
div.order {
  color: white;
  background-image: url("../images/Bitmap%20Copy%206.png");
  div.order-content {
    background-color: rgba(126, 180, 224, 0.65);
  }
  h1 {
    padding-top: 200px;
  }
  form {
    padding-top: 75px;
    padding-bottom: 200px;
    width: 100%;
    margin: 0 auto;
    text-align: center;
    ul {
      li {
        float: left;
      }
    }
  }
}

In different places added margin: 0 auto;
text-align: center;
but the result is the same. It is desirable that then it could be done adaptively.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
P
Pavel, 2015-11-13
@kentuck1213

well, you need a fixed width in order for margin auto to work

M
Mikhail, 2015-11-13
Chirskiy @chirskiy_mixail

You can, for example, like this, without knowing the width of
jsfiddle.net/cr1j431v/1
, you can also do this:

.form {
left: 50%;
position: absolute;
transform: translateX(-50%);
}

A
Alexander Zachinalov, 2015-11-13
@SanDiesel

codepen.io/anon/pen/GpPOwY

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question