I am new to Ionic framework, I am trying to create an ion-list like in the picture, but I can't figure out how to use item-thumbnail-right and item-avatar in the one item with some stuff in the right corner and a pseudo footer like in the picture...
I tried this code:
<ion-list>
<a class="item item-thumbnail-right" ng-repeat="activeOffer in activeOffers"
ng-href="#/app/offers/{{activeOffer.offer.id}}">
<img ng-src="{{siteRoot}}/upload/assets/img/media-support/{{activeOffer.mediaSupport.fileName}}">
<div class="item item-avatar">
<img ng-src="{{siteRoot}}/upload/assets/img/localbusiness/{{activeOffer.localBusiness.logo}}">
<h2>{{activeOffer.localBusiness.label}}</h2>
<p>{{activeOffer.localBusiness.description}}</p>
</div>
<h2>{{activeOffer.offer.title}}</h2>
<p>{{activeOffer.offer.description}}</p>
</a>
</ion-list>
But, I'm getting something ugly
Try with following example:
<ion-item class="item-remove-animate item-avatar-right" ng-repeat="item in listingData.app" type="item-text-wrap" href="#/tab/restaurant_category/{{item.rest_id}}">
<img ng-src="{{item.logo}}">
<img src="" style="float:left;width: 15px;height: 15px;">
<h2>{{item.restaurant_name}}</h2>
<p ng-repeat="cuisne in item.available_cuisine.cuisine">{{cuisne.name}}</p>
<div class="row order-policy-time">
<div class="col col-50">
<p>delivers in 60 min</p>
</div>
<div class="col text-right">
<p>collection in 30 min</p>
</div>
</div>
<div class="welcome-custom-icon">
<span class="ti-angle-right"></span>
</div>
</ion-item>
Related
I've made bootstrap cards that appear on two different pages. One on the landing page which I want to increase the spacing and one on the books page which I want to increase the width of the cards. Here's the code that I've written and used in both pages. The only thing that I've changed is on the 6th line from '...col-lg-3' to '...col-lg-2'. If anyone can assist me in adding the spacing and increasing the with of the card, help me if you can. d-flex justify-content-evenly doesn't work when i use col-lg-3.
<section id="about" class="ts-block" >
<div id="cards_landscape_wrap-2">
<div class="container " style="width:70%">
<div class="row d-flex justify-content-around">
#foreach($products as $product)
<div class="col-xs-12 col-sm-6 col-md-3 col-lg-3">
<a href="{{route("products.show",$product->slug)}}">
<div class="card-flyer ">
<div class="text-box">
<div class="image-box">
<img src="{{asset($product->image)}}" alt="{{$product->title}}" class="img-fluid rounded mx-auto d-block" width="100%"/>
</div>
<div class="card-footer">
<i class="text-muted"><strike>Ksh.{{$product->old_price}}</strike></i>
<span class="text-primary font-weight-bold">Ksh.{{$product->price}}</span><br>
<span class="mybuttonoverlap btn btn-primary">View</span>
</div>
</div>
</div>
</a>
</div>
#endforeach
</div>
</div>
</div>
</section>
Try including d-flex justify-content-around to a direct parent containing the cards instead of
<div class="row d-flex justify-content-around">. And add margin to the card.
<div class="col-xs-12 col-sm-6 col-md-3 col-lg-3 d-flex justify-content-around">
<a href="{{route("products.show",$product->slug)}}">
<div class="card-flyer m-2">
<div class="text-box">
<div class="image-box">
<img src="{{asset($product->image)}}" alt="{{$product->title}}" class="img-fluid rounded mx-auto d-block" width="100%"/>
</div>
<div class="card-footer">
<i class="text-muted"><strike>Ksh.{{$product->old_price}}</strike></i>
<span class="text-primary font-weight-bold">Ksh.{{$product->price}}</span><br>
<span class="mybuttonoverlap btn btn-primary">View</span>
</div>
</div>
</div>
</a>
</div
I am pulling in content from a JSON file to populate a grid of products for an eCommerce website I'm working on. when the data loads it displays all the products in 1 column or (1 row) instead of in a grid. All the CSS for this part of from default Bootstrap 4 values. I need your assistance to go about this.
Thanks
Here is the code to display them on a page I called "products"
<div class="product container d-flex justify-content-center mt-50 mb-50">
<div class="card">
<div class="card-body">
<div class="card-img-actions"> <img src="{{product.imageUrl}}" class="card-img img-fluid" width="96" height="350" alt=""> </div>
</div>
<div class="card-body bg-light text-center">
<div class="mb-2">
<h6 class="font-weight-semibold mb-2"> <a routerLink="/products/{{product.id}}" class="text-default mb-2" data-abc="true">{{product.title}}</a> </h6>
</div>
<h3 class="mb-0 font-weight-semibold">{{product.price}}</h3>
Available in size: {{product.size}}
<button type="button" class="btn bg-cart"> Buy Now </button>
</div>
</div>
</div>
Then below is what I have on the products.components.html
<app-header></app-header>
<app-item *ngFor="let product of products" [product]= "product"></app-item>
<app-footer></app-footer>
This is the expected result I want to acheive
Here is what I am getting
enter image description here
I think you did not follow the bootstrap principles of how to construct a card grid.
When you put your .container class into the app-item, you will create a new container on each loop, which you don't want I guess. Instead you only want one container and then the cards as columns.
See https://getbootstrap.com/docs/5.1/components/card/#grid-cards
<app-header></app-header>
<div class="container">
<div class="row row-cols-md-3">
<ng-container *ngFor="let product of products">
<app-item [product]="product"></app-item>
</ng-container>
</div>
</div>
<app-footer></app-footer>
And in your app-item you only have columns.
<div class="product col">
<div class="card">
...
</div>
</div>
I thought what I'm trying to do would be pretty easy to do but I just can't make it work.
I tried to do pull-left on bootstrap cards and panels and it's not working the way I want it to...
Here is a picture of what I'd like to acheive
Example
Heres code that almost works
<div class="card text-center" *ngFor="let event of eventActivities">
<div class="card-header pull-left">
<img src="..." alt="">
Title </div>
<div class="card-block">
<h4 class="card-title">Title</h4>
<p class="card-text">Description</p>
BUTTON
</div>
<div class="card-footer text-muted">
FOOTER
</div>
</div>
There are a few different ways you could do this. Here's one way using the flex-row and flex-wrap utility classes to change the layout of elements inside the card...
https://www.codeply.com/go/l1KAQtjjbA
<div class="card flex-row flex-wrap">
<div class="card-header border-0">
<img src="//placehold.it/200" alt="" />
</div>
<div class="card-block px-2">
<h4 class="card-title">Title</h4>
<p class="card-text">Description</p>
BUTTON
</div>
<div class="w-100"></div>
<div class="card-footer w-100 text-muted">
FOOTER
</div>
</div>
Here's another approach using the grid...
<div class="card">
<div class="row no-gutters">
<div class="col-auto">
<img src="//placehold.it/200" class="img-fluid" alt="">
</div>
<div class="col">
<div class="card-block px-2">
<h4 class="card-title">Title</h4>
<p class="card-text">Description</p>
BUTTON
</div>
</div>
</div>
<div class="card-footer w-100 text-muted">
Footer stating cats are CUTE little animals
</div>
</div>
https://www.codeply.com/go/l1KAQtjjbA
I'm not sure why you have text-center as nothing it centered in the desired example image.
HTML:
<div class="card">
<div class="card-horizontal">
<div class="img-square-wrapper">
<img class="" src="http://via.placeholder.com/300x180" alt="Card image cap">
</div>
<div class="card-body">
<h4 class="card-title">Card title</h4>
<p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
</div>
</div>
<div class="card-footer">
<small class="text-muted">Last updated 3 mins ago</small>
</div>
</div>
CSS:
.card-horizontal {
display: flex;
flex: 1 1 auto;
}
Result:
Keep in mind that the class pull-left is now float-left in Bootstrap version 4.
I have to display a series of cards using ng-repeat. Something like.
What I am currently doing is
<ion-view view-title="Active">
<div class ='child_div_1'>
<div class="card cardS" collection-item-width="'20%'" collection-item-height="40%">
<div class="item item-text-wrap">
<p>dljfweiuf</p>
</div>
</div>
</div>
<div class ='child_div_2'>
<div class="card" collection-repeat="item in items" collection-item-width="'25%'" collection-item-height="60%">
<div class="item item-text-wrap " id="cards">
{{item}}
</div>
</div>
</div>
</div>
What I am getting in my view is
Can anyone help me with how to create gap between the cards the gap between two cards.
add padding css property to the ng repeating div
<div class ='child_div_2'>
<div class="card" collection-repeat="item in items" collection-item-width="'25%'" collection-item-height="60%" style="padding: 15px;">
<div class="item item-text-wrap " id="cards">
{{item}}
</div>
</div>
</div>
I've image need code css:
And here my html
<div class="row dvMarTop1">
<div class="col-sm-6" >
<div class="row">
<div class="col-sm-7" >
<img src="images/img230.jpg" class="img-responsive" />
</div>
<div class="col-sm-5" style="background-color: #f1f1f1;">
<div>
<div>Tiêu điểm</div>
<div>Mark Zuckerberg thất vọng vì vệ tinh 200 triệu USD bị tên lửa SpaceX thiêu rụi</div>
</div>
</div>
</div>
<div class="row dvMarTop1" style="background-color:#fff">
<div class="col-sm-4">
<img src="http://imgur.com/79u89Sj" class="img-responsive" />
</div>
<div class="col-sm-8">
<span>
Nghệ An: Cá chết dạt do thuyền chở cá chìm
<font><i class="fa fa-clock-o dvMarTop1 dvTimeItem"></i> 20:00 | Chủ nhật, 15/06/2016</font>
</span>
</div>
</div>
</div>
But as you see I cannot set full background for col-sm-5 and set vertical center text
Can you suggest more ? tks so much
Either you didn't refresh your browser page after you edited the code or you didn't place your style.css under the other CSS links in the head part of the code.