0

Currently, when the browser's width become smaller... my icons end up floating to the left.

enter image description here

How can I have them centered horizontally? Any help will be appreciated.

HTML:

<div ng-app="sandbox">
  <div layout="column" layout-fill>
    <div class="flexbox-parent">
      <div layout="row" layout-align="center center" style="height: 600px;">
        <div id="icons">
          <i class="fa fa-facebook fa-5x circle-icon"></i>
          <i class="fa fa-facebook fa-5x circle-icon"></i>
          <i class="fa fa-facebook fa-5x circle-icon"></i>
        </div>
      </div>
    </div>
  </div>
</div>

CSS:

#icons i {
  color: #fff;
  margin-left: 10px;
  margin-right: 10px;
}

.circle-icon {
  background: #3b5998;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  text-align: center;
  line-height: 100px;
  vertical-align: middle;
  padding: 30px;
}

I have tried using layout-align="center center" on #icons

JSFiddle Demo

2 Answers 2

1

I'm not sure if there is a Angular Material class for that, but you can achieve this by manually setting text-align: center on your wrapper. In four example you'd go like this:

#icons {
  text-align: center;
}

Fiddle

Sign up to request clarification or add additional context in comments.

2 Comments

Ah! Simple solution... Not sure what I was thinking
Glad I could help. As mentioned, there still be a better solution. I've also took a look into the docs but couldn't find any properly working solution so far. Maybe that's the real deal here.
1

You don't need any CSS - CodePen

Markup

<div ng-controller="AppCtrl" ng-cloak="" ng-app="MyApp" layout-fill layout="column" layout-align="center center">
  <div layout="column">
    <i class="fa fa-facebook fa-5x circle-icon"></i>
    <i class="fa fa-facebook fa-5x circle-icon"></i>
    <i class="fa fa-facebook fa-5x circle-icon"></i>
  </div>
</div>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.