Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49526

Best way to center contents in a view

$
0
0

@stevenfitzpatrick wrote:

I have a div I am trying to center on a view in ionic.

In my view I place a search box at the top and then on the remaining space i want to horizontally and vertically center a div.

<form ng-submit="vm.searchQuery() && searchForm.$valid" name="searchForm" novalidate>
        <div class="list search-box">
            <label class="item item-input">
                <i class="icon ion-search placeholder-icon"></i>
                <input type="text" placeholder="Address">
            </label>
        </div>
        </form>
        <div class="home-shortcuts">
...
</div>

With .home-shortcuts being the the div I would like to vertically center.

.home-shortcuts{
    position: absolute;
    left: 0%;
    right: 0%;
    top: 25%;
    bottom: 25%;
}

This kinda worked but I find it jumps around when the keyboard opens / closes so wanted to use something without absolute positioning.

Any ideas ?

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 49526

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>