How to align Material Design Lite cards to right hand side

Akshay Soma picture Akshay Soma · Jan 8, 2017 · Viewed 11.7k times · Source

I'm trying to build a simple page which have cards using material design lite components but one problem stucks the whole layout of the page. How to align the mdl card to right hand side of the screen ? I have tried by float:right; in css then the card is only shifting towards right in that same col not to the screen. Help me to shift it

Answer

MewX picture MewX · Dec 29, 2017

Try this class mdl-typography--text-right, in this way, the contents in that cell will have an alignment of right:

<div class="mdl-cell mdl-cell--6-col mdl-typography--text-right">
    <div class="demo-card-wide mdl-card mdl-shadow--2dp">
        <div class="mdl-card__title">
            <h2 class="mdl-card__title-text">Welcome</h2>
        </div>
        <div class="mdl-card__supporting-text">
            Lorem ipsum dolor sit amet, consectetur adipiscing elit.
            Mauris sagittis pellentesque lacus eleifend lacinia...
        </div>
        <div class="mdl-card__actions mdl-card--border">
            <a class="mdl-button mdl-button--colored mdl-js-button mdl-js-ripple-effect">
                Get Started
            </a>
        </div>
        <div class="mdl-card__menu">
            <button class="mdl-button mdl-button--icon mdl-js-button mdl-js-ripple-effect">
                <i class="material-icons">share</i>
            </button>
        </div>
    </div>
</div>

Vice versa: mdl-typography--text-center and mdl-typography--text-left also work.