1

I use the bellow less code to let the con-order width 80%:

.con-order {

    height: 100%;
    width: 80%;
    overflow: hidden;

the html code is like bellow:

<div class="con-order">
    <div class="alert">
      <Alert type="warning" show-icon closable>
    ...

it bellow like this, I want the content move center.

enter image description here

I tried use text-align: center; but the content become odd.

It become like this, I don't want this:

enter image description here

I want all move to center, not all content align center.

user7693832
  • 6,119
  • 19
  • 63
  • 114
  • Are you looking for https://stackoverflow.com/questions/4955122/what-exactly-is-needed-for-margin-0-auto-to-work ? – l2aelba Apr 16 '18 at 12:45

2 Answers2

1

This will work fine for you.

.con-order {
    height: 100%;
    width: 80%;
    overflow: hidden;
    margin: 0 auto;
0

The margin: 0 auto is what does the actual centering of your div.

It will make the element center horizontally and it works without setting a specific width.

.con-order {
  height: 100%;
  width: 80%;
  overflow: hidden;
  margin: 0 auto;
}
ochs.tobi
  • 3,214
  • 7
  • 31
  • 52