为什么输入框不在背景图片之上?

why input field not above the background image?

我正在尝试制作简单的单页应用程序,其中包含页眉、页脚和竞争(具有背景图像)输入字段。当我添加输入字段时,它会剪切背景图像。我需要该输入字段位于背景图像之上..你能告诉我我哪里做错了吗意思是如何在背景图片上方添​​加输入字段 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; left: 0; right: 0; top: 43px; bottom: 43px;">
            <label class="item item-input">
                <span class="input-label">Username</span>
                <input type="text">
            </label>
        </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> 

您的输入字段位于背景图像上方,您不能 "see" 因为输入字段没有边框。这会在白色背景上留下一个纯白色的输入字段。

将此添加到您的 CSS 以查看输入字段的轮廓:

input{border:1px solid #000 !important;}

编辑: 最初的问题我不清楚。 OP 澄清问题是输入字段的白色背景覆盖了背景图像。将背景转换为透明将解决问题:.item{background-color:transparent !important;}

实例:

.item{background-color:transparent !important;}
input{border:1px solid #000 !important;}
.bar {
        position: relative!important
    }
    .bg {
        border: 1px solid red;
        background: url('https://d262ilb51hltx0.cloudfront.net/max/800/1*AJALCafqXhfLMG7iF7Ho0A.jpeg')!important;
        background-color: red!important;
        background-repeat: no-repeat!important;
        background-position: center!important;
        background-size: cover!important;
        
    }
<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; left: 0; right: 0; top: 43px; bottom: 43px;">
            <label class="item item-input">
                <span class="input-label">Username</span>
                <input type="text">
            </label>
        </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>