Search code examples
htmlcsstwitter-bootstrapcol

Bootstrap col-offset


I am using col-xs-offset-1 to center each column in a block style layout on xs screens. However, on large screens I am using col-lg-offset-3 to display the row in-line and centered on the screen. By doing this it seems as though col-xs-offset-1 is overriding col-lg layout so now the columns on the large screen are no longer centered (See link for picture). What is causing this? How can I have it both ways? badges not centered

<div class="container-fluid">
        <div class="row">
            <div class="list-group">
                <div class="col-xs-offset-1 col-xs-10 col-sm-offset-3 col-sm-2 col-md-offset-3 col-md-2 col-lg-offset-3 col-lg-2">
                    <a href="http://hyperurl.co/cplq6c" class="list-group-item" target="_blank">
                        <i class="fa fa-apple fa-2x" aria-hidden="true" style="color: whitesmoke;"></i>itunes
                    </a>
                </div>

                <div class="col-xs-offset-1 col-xs-10 col-sm-2 col-md-2 col-lg-2">
                    <a href="http://hyperurl.co/1qcfl6" class="list-group-item" target="_blank">
                        <i class="fa fa-amazon fa-2x" aria-hidden="true" style="color: #ff9900;"></i>amazon
                    </a>
                </div>

                <div class="col-xs-offset-1 col-xs-10 col-sm-2 col-md-2 col-lg-2">
                    <a href="http://hyperurl.co/mb95g4" class="list-group-item" target="_blank">
                        <i class="fa fa-google fa-2x" aria-hidden="true" style="color: #34a853;"></i>google play
                    </a>
                </div>
            </div>
        </div>
    </div>

Solution

  • A Bootstrap offset applies from small to large, so a col-xs-offset-1 will affect columns greater than xs. You can add a col-sm-offset-0 to prevent the offset from affecting larger columns.