user944513
user944513

Reputation: 12729

why background image not display?

I am trying to make simple app single page app .Actually I take background image which is placed on it display when I used <ion-content class="bg" style="position:absolute!important"> position:absolute but it display in small area .I need to display on whole contend .In other words in whole contend tag complete screen. here is my code

http://codepen.io/anon/pen/pvYdNM

<html ng-app="ionicApp">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <title>Ionic List Directive</title>

    <link href="//code.ionicframework.com/nightly/css/ionic.css" rel="stylesheet">
    <script src="//code.ionicframework.com/nightly/js/ionic.bundle.js"></script>
  </head>

  <body >
        <ion-view>
      <ion-header-bar class=" bar bar-positive ">
      <h1 class="title">Title!</h1>    

      </ion-header-bar>
      <ion-content class="bg"  style="position:absolute!important">
          <h1 >contend</h1>
          </ion-content>
          <ion-footer-bar class=" bar bar-footer bar-positive" style="position:fixed!important">
           <h1 class="title">Fotter!</h1>
          </ion-footer-bar>
      </ion-view>



  </body>
</html>

Upvotes: 0

Views: 485

Answers (4)

Phe0nix
Phe0nix

Reputation: 157

You could just add

height: 100%;
width: 100%;

to your .bg css rule

Upvotes: 0

El Devoper
El Devoper

Reputation: 1093

Just tell it how big it should be.

Something like:

<ion-content class="bg"  style="position:absolute; left: 0; right: 0; top: 43px; bottom: 43px;">

should work.

Upvotes: 2

Nema
Nema

Reputation: 397

You should update css rule for class bg. The easiest way is to just add: top:0; left:0; right:0; bottom:0; to the bg class.

Upvotes: 0

Burak Karakuş
Burak Karakuş

Reputation: 1410

Because your content has a bg class which doesn't cover all of your page. You set bg class's background, not the body's background. You should do this: http://codepen.io/anon/pen/pvYpVw

body 
{background: url('https://d262ilb51hltx0.cloudfront.net/max/800/1*AJALCafqXhfLMG7iF7Ho0A.jpeg')!important;}

Upvotes: 0

Related Questions