我正在尝试制作简单的单页应用程序,其中包含页眉,页脚和竞争(具有背景图像)输入字段。当我添加输入字段时,它会剪切背景图像。我需要输入字段位于背景图像上方。你可以告诉我我做错了什么意思是如何在背景图像上添加输入字段 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>
答案 0 :(得分:1)
您的输入字段位于背景图像上方,您无法“看到”它,因为输入字段没有边框。这会在白色背景上留下纯白色输入字段。
将其添加到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>