我做了一个这样的设计
如何用css掩盖背景?
我试过这样的代码
.img-poster {
display: block;
max-width: 100%;
-webkit-mask-image: url(https://cdn.pbrd.co/images/GYiCod1.png), url(https://cdn.pbrd.co/images/GYiCQsM.png);
-webkit-mask-position: bottom center, center center;
-webkit-mask-repeat: no-repeat, no-repeat;
}
.add {
-webkit-mask-composite: add;
}
Run Code Online (Sandbox Code Playgroud)
<section class="section poster-container">
<img src="https://imagejournal.org/wp-content/uploads/bb-plugin/cache/23466317216_b99485ba14_o-panorama.jpg" alt="" class="img-poster add img-responsive">
</section>
Run Code Online (Sandbox Code Playgroud)
我使用的蒙版图像是
https://i.stack.imgur.com/fg2k5.png
https://i.stack.imgur.com/zmylJ.png
你们能告诉我我的代码有什么问题吗?我知道我只能导入到 png,但我尝试使用 css
我正在尝试学习如何在工厂内获取数据.目前我正在使用控制器获取数据
factory.js
angular
.module('app')
.factory('Product', ['$http', function($http){
return{
get: function(){
return $http.get('https://raw.githubusercontent.com/vicariosinaga/learn/master/products.json').then(function(response){
return response.data;
});
}
};
}])
Run Code Online (Sandbox Code Playgroud)
细节poduct.js
angular
.module('app')
.controller('productDetailsCtrl',['$scope','$stateParams', 'Product', function($scope,$stateParams,Product){
$scope.id=$stateParams.id;
Product.get().then(function(data) {
$scope.singleItem = data.filter(function(entry){
return entry.id === $scope.id;
})[0];
});
}]);
Run Code Online (Sandbox Code Playgroud)
产品detail.html
<a href="{{singleItem.url}}">
<p>{{singleItem.id}}</p>
<p>{{singleItem.name}}</p>
<img src="{{singleItem.image}}" alt="{{singleItem.name}}">
</a>
Run Code Online (Sandbox Code Playgroud)
但是当我更改代码以在工厂内移动fecthing时就像这个factory.js
return{
get: function(){
return $http.get('https://raw.githubusercontent.com/vicariosinaga/learn/master/products.json').then(function(response){
return response.data;
});
},
find: function(){
return $http.get('https://raw.githubusercontent.com/vicariosinaga/learn/master/products.json').then(function(response){
var singleItem = data.filter(function(entry){
return entry.id === id;
})[0];
});
}
};
Run Code Online (Sandbox Code Playgroud)
细节product.js
angular
.module('app')
.controller('productDetailsCtrl',['$scope','$stateParams', 'Product', function($scope,$stateParams,Product){
Product.find($stateParams.product,function(singleItem){
$scope.singleItem …
Run Code Online (Sandbox Code Playgroud) 我试图像 bootstrap 一样创建 CSS 网格col
。我想从左侧和右侧添加 15px 的填充。但是当我添加属性时,它会打破浮动(使其不能并排站立)。
这是示例:https : //jsfiddle.net/t29q1gcL/
为什么不起作用?
.grid-4{
float: left;
width: 40%;
background: red;
padding: 0 15px;
}
.grid-6{
float: left;
width: 60%;
background: blue;
padding: 0 15px;
}
Run Code Online (Sandbox Code Playgroud)