Mat-card is not specifying gap below and above the row - css

I am trying to specify some gap between two rows while displaying mat cards. But it is not showing properly after using flex.
This is the HTML file:-
<div fxLayout="row wrap" fxLayoutAlign="space-around">
<mat-card class="list-card" *ngFor="let uri of urlData" fxLayoutGap="20px">
<mat-card-header>
<mat-card-title>{{uri.title}}</mat-card-title>
<mat-card-subtitle>3 weeks ago</mat-card-subtitle>
</mat-card-header>
<img mat-card-image src="https://uU0bbBPEJvIK7H7f4qaSuQ.jpeg(58 kB)
https://uU0bbBPEJvIK7H7f4qaSuQ.jpeg
" alt="img alt title">
<mat-card-content>
<a href="https://medium.....64" class="mat-caption">
{{uri.documentURL}} </a>
<!-- <section> -->
<mat-chip-list>
<mat-chip>Angular</mat-chip>
</mat-chip-list>
<!-- </section> -->
<p>
{{uri.description}}
</p>
</mat-card-content>
<mat-card-actions>
<mat-icon>share_outline</mat-icon>
<mat-icon>bookmark_outline</mat-icon>
</mat-card-actions>
</mat-card>
</div>
This is the css:-
.list-card{
max-width: 260px;
}

There are two options to do that
1: Use flexLayoutGap as you had done for row gap, but you need to customize your structure as mention here
for bottom gap you need to use flex column as well.
2: Use margin-bottom on your card class .list-card
.list-card{
margin-bottom: 20px;
}

.list-card{
max-width: 260px;
margin: 10px;
}
try this code

Related

Remove slide number text from top of ng carousal

I am using this carousal from ng-bootstrap :
<ngb-carousel [showNavigationArrows]="showNavigationArrows" [showNavigationIndicators]="showNavigationIndicators">
<ng-template ngbSlide>
<div class="picsum-img-wrapper">
<img src="assets\fsfhjllz_vegetables-banner.png" class="mh-100" style="width: 100%; height: 30vh; object-fit:cover;">
</div>
</ng-template>
<ng-template ngbSlide>
<div class="picsum-img-wrapper">
<img src="assets\vh9oeys6_fruit-banner.png" class="mh-100" style="width: 100%; height: 30vh; object-fit: cover;">
</div>
</ng-template>
</ngb-carousel>
And it shows this text on top of image like:: slide 1 of 2 .
How do I remove this text and only show image.
It is showing up as this when inspected in browser::
<div role="tabpanel" class="carousel-item" id="slide-ngb-slide-1">
<span class="sr-only"> Slide 2 of 2 </span> // this one
Here is the source code of this peace:
<span class="sr-only" i18n="Currently selected slide number read by screen reader##ngb.carousel.slide-number">
Slide {{i + 1}} of {{c}}
</span>
I see 2 possibilities to hide this text:
add the CSS to hide .carousel-inner .sr-only to hide this element, eg
.carousel-inner .sr-only {
display: none;
}
set the value of the translation key ngb.carousel.slide-number to an empty string. Guidelines on internatiolization.

Make all images in mat-card-image same size but scale correctly

This usually isnt a problem but just Material 2 is very under-documented atm so im having trouble making all images the same size but properly resize with window change
All the images I have were pretty similar in size when I created then but one was abit longer height wise, but my old code just adjusted that with some bootstrap calls.
But using the image in a mat-card it is a longer length and thus looks out of place shown here:
The BAC calculator's image is longer than the rest so it looks out of place and pushes others out of proportion under it or forces an empty cell, here is my call for displaying these:
<div *ngIf="data;else other_content">
<div class="row">
<div *ngFor="let project of data" class="col-md-6">
<div>
<mat-card class="mat-elevation-z4">
<mat-card-header>
<div mat-card-avatar class="example-header-image"></div>
<mat-card-title>{{project.title}}</mat-card-title>
<mat-card-subtitle>{{project.category}}</mat-card-subtitle>
<div class="grow-empty"></div>
<div *ngIf="project.source">
<button mat-raised-button (click)="openSite(project.source)">SOURCE</button>
</div>
</mat-card-header>
<img mat-card-image src="{{project.image}}" alt="{{project.title}}">
<mat-card-content>
<p>
{{project.detail | slice:0:250}}...
</p>
</mat-card-content>
<mat-card-actions>
<button mat-raised-button>Information</button>
</mat-card-actions>
</mat-card>
</div>
<br>
</div>
</div>
</div>
If I set the height as a static like '300', it technically fixes the issue but rescaling will just ruin it
I want it to be a set scale like it is, but take any image and scale it up/down to sit and be an appropriate size for the card itself (like Callum.Tech card for example)
Just add this style reference in your code.
If you want to apply this styles to all your cards in the view, add to your style file:
mat-card img{
object-fit: cover; /*this makes the image in src fit to the size specified below*/
width: 100%; /* Here you can use wherever you want to specify the width and also the height of the <img>*/
height: 80%;
}
Another solution to this issue may be using the class of bootstrap "img-responsive". Here is a brief description
Just add css-class to the image and and style the image from the SCSS file.
<img mat-card-image class="imgs src="{{project.image}}" alt="{{project.title}}">
Now in SCSS:
imgs {
height: 50px;
width: 50px;
}
And for more to Information visit W3school.com/image.

3 Scaling images inline

So, I created an image in photoshop that is 1920x1080 and I've spliced it into sections, so that the images that require a link can have an javascript tag attached to them for a link.
I want the images to scale depending on the type of monitor you're using, as long as you're in a 16:9 ratio. The problem I'm having, is in regards to the way the images align 3 in a row. Either the 3rd image in the row gets pushed down, for sections with 3 images. Or, the image is the full size 1920x1080, but no scaling and gaps between images.
My HTML looks like this:
<main>
<section>
<img src="images/NuclearFuelCycle1.png"/>
</section>
<section>
<div><img id="1" src="images/NuclearFuelCycle2.png"/><span style="cursor:pointer" onclick="openMining()"><img id="2" src="images/NuclearFuelCycle3.png"/></span><img id="3" src="images/NuclearFuelCycle4.png"/></div>
</section>
<section>
<img src="images/NuclearFuelCycle5.png"/></section>
<section>
<img src="images/NuclearFuelCycle6.png"/><span style="cursor:pointer" onclick="openConversion()"><img src="images/NuclearFuelCycle7.png"/></span><img src="images/NuclearFuelCycle8.png"/>
</section>
<section>
<img src="images/NuclearFuelCycle9.png"/>
</section>
<section>
<img src="images/NuclearFuelCycle10.png"/><span style="cursor:pointer" onclick="openEnrichment()"><img src="images/NuclearFuelCycle11.png"/></span><img src="images/NuclearFuelCycle12.png"/>
</section>
<section>
<img src="images/NuclearFuelCycle13.png"/>
</section>
<section>
<img src="images/NuclearFuelCycle14.png"/><span style="cursor:pointer" onclick="openReactor()"><img src="images/NuclearFuelCycle15.png"/></span><img src="images/NuclearFuelCycle16.png"/>
</section>
<section>
<img src="images/NuclearFuelCycle17.png"/>
</section>
<section>
<img src="images/NuclearFuelCycle18.png"/><span style="cursor:pointer" onclick="openSpentFuel()"><img src="images/NuclearFuelCycle19.png"/></span><img src="images/NuclearFuelCycle20.png"/>
</section>
<section>
<img src="images/NuclearFuelCycle21.png"/>
</section>
<section>
<img src="images/NuclearFuelCycle22.png"/><span style="cursor:pointer" onclick="openFuelFabrication()"><img src="images/NuclearFuelCycle23.png"/></span><img src="images/NuclearFuelCycle24.png"/>
</section>
<section>
<img src="images/NuclearFuelCycle25.png"/></section>
<section>
<img src="images/NuclearFuelCycle26.png"/><span style="cursor:pointer" onclick="openStorageDisposal()"><img src="images/NuclearFuelCycle27.png"/></span><img src="images/NuclearFuelCycle28.png"/>
</section>
<section>
<img src="images/NuclearFuelCycle29.png"/>
</section>
</main>
My CSS looks like this:
* {
margin: 0;
padding: 0;
border: 0;
border-collapse: collapse;
}
body {
max-width: 100% !important;
height: auto;
}
main {
display: inline-block;
padding: 10px;
}
section div img{
width: auto;
}
Some of this code is not useful... It's me experimenting to try and create a solution. Any help would be greatly appreciated, I have to submit this in 2 days P
The 'spaces' problem is most likely due to the way display:inline works, which is what an image and a span is. Any newlines, etc get treated as a space char. An easy fix could be something that uses display:flex.
The second (and main part) of your problem is that you want to scale based on width. A little bit of javascript and use of transform: scale(...) fixes that. Below is a snippet (which can't show resizing), so here's a CodePen too: https://codepen.io/anon/pen/PpXpwO
window.onresize = resizer;
resizer();
function resizer() {
console.log("resized")
var _main = document.querySelector("main");
var image_width = 600; // the original image width
var ratio = _main.offsetWidth/image_width;
_main.style.transform = "scale("+ratio+")";
};
main {
transform-origin: 0 0;
}
section {
display: flex;
flex-direction: row;
flex-wrap: nowrap;
}
section * {
flex: 0 0 auto;
display: block;
}
<main>
<section>
<img src="https://placehold.it/600x150g" />
</section>
<section>
<img id="1" src="https://placehold.it/100x150" />
<a style="cursor:pointer" onclick="openMining()"><img id="2" src="https://placehold.it/300x150/370000" /></a>
<img id="3" src="https://placehold.it/200x150" />
</section>
<section>
<img src="https://placehold.it/600x150g" />
</section>
</main>
If I'm understanding correctly your sliced image segments are repositioning incorrectly as the browser window resizes.
Rather than slicing up your image and using javascript, why not try a pure HTML solution and use the <map> tag to insert your links at various parts of the image?
Here's a Fiddle demonstrating a scalable HTML image map (uses the image-map-resizer plugin)
You can learn more about image maps here.

Getting my footer div color to go vertical in responsive design. bootstrap 3

I am trying to get my footer, which has a grey color to show this color all the way to the bottom in my responsive design. It goes all the way across the page when in PC view mode, when I take it to the mobile size, the box only shows for half of the footer and then cuts off. I am not sure why it's not working for me.
Thanks ahead of time for taking a look.
HTML:
div id="footer">
<div class="container">
<div class="row">
<h3 class="footertext">About Us:</h3>
<br>
<div class="col-md-4">
<center>
<img src="http://oi60.tinypic.com/w8lycl.jpg" class="img-circle" alt="the-brains">
<br>
<h4 class="footertext">Sitemap info 1</h4>
<p class="footertext">here is some site map info<br>
</center>
</div>
<div class="col-md-4">
<center>
<img src="http://oi60.tinypic.com/2z7enpc.jpg" class="img-circle" alt="...">
<br>
<h4 class="footertext">Sitemap info 2</h4>
<p class="footertext">here is some more site map info<br>
</center>
</div>
<div class="col-md-4">
<center>
<img src="http://oi61.tinypic.com/307n6ux.jpg" class="img-circle" alt="...">
<br>
<h4 class="footertext">sitemap info 3</h4>
<p class="footertext">This is some more of it.<br>
</center>
</div>
</div>
<div class="row">
<p><center>Contact Stuff Here <p class="footertext">Copyright 2014</p></center></p>
</div>
</div>
</div>
CSS:
#footer {
position: absolute;
bottom: 0;
left: 0;
right: 0;
width: 100%;
/* Set the fixed height of the footer here */
height: 280px;
background-color:#B6B6B4;
/*
You are using col-md-4 classes for your grid, causing each column take a full row in mobile view and your footer is not going all the way to the bottom of page because of its fixed height (280px).
Try using col-xs-4 for x-small devices and appropriate classes for other windows sizes.
This can be achieved by doing something like <div class="col-md-4 col-xs-6">Content</div> which means this columns will use 4 grids in desktop view and 6 grids in mobile viewport.
More documentation can be found here, under 'Grid options' section.
By the way, <center> tag is obsolete, I would recommend you to use Bootstrap's text-center CSS class.
First of all I would recommend posting your code in jsfiddle for easier debugging: http://jsfiddle.net/r7mTc/
In jsfiddle above you will see that content of the footer is way higher than the footer itself and stick out of it.
Now look here: http://jsfiddle.net/r7mTc/1/ I just deleted height line in CSS ;)
I also see few other problems in your code:
<p><center>Contact Stuff Here <p
class="footertext">Copyright 2014</p></center></p>
Tag p can contain only inline elements like span or img, so there shouldn't be nested p tags.
<p class="footertext">here is some more site map info<br>
Tag p should always has be closed, so you should add </p> after <br>
<center> tag is deprecated. Better practise is to use CSS for that - for example text-align:center for inline elements or margin:auto for blocks.

How to align like-buttons on my website between <div> elements and put a white background to them?

my like buttons are above my page-body , they are in the right position but are aligned with and the code is ugly. I would also need to add a white background only to the like-buttons because I will make them float with the page if you will scroll down and for this I also need to set a "div id" to the like-buttons. How can I align the like-buttons with CSS in the same position they are now and set a "div id" to them ? I also need them to be aligned vertically because facebook button is a little bit lower than google and twitter.
For example, if you access this page: http://www.cumseface.eu/viewtopic.php?t=187 , you can see the like-buttons just below the ad. I`m a beginner at CSS and HTML so if you can help please be specific. Sorry for my bad english and thanks in advance.
And here is the HTML code that I`m using for the part with the buttons:
<div class="topic-actions">
<div class="buttons">
<!-- IF not S_IS_BOT and S_DISPLAY_REPLY_INFO -->
<div class="<!-- IF S_IS_LOCKED -->locked-icon<!-- ELSE -->reply-icon<!-- ENDIF -->"><span></span><!-- IF S_IS_LOCKED -->{L_TOPIC_LOCKED_SHORT}<!-- ELSE -->{L_POST_REPLY}<!-- ENDIF --></div>
<!-- ENDIF -->
</div>
<!-- IF S_DISPLAY_SEARCHBOX -->
<div class="search-box">
<form method="get" id="topic-search" action="{S_SEARCHBOX_ACTION}">
<fieldset>
<input class="inputbox search tiny" type="text" name="keywords" id="search_keywords" size="20" value="{L_SEARCH_TOPIC}" onclick="if(this.value=='{LA_SEARCH_TOPIC}')this.value='';" onblur="if(this.value=='')this.value='{LA_SEARCH_TOPIC}';" />
<input class="button2" type="submit" value="{L_SEARCH}" />
{S_SEARCH_LOCAL_HIDDEN_FIELDS}
</fieldset>
</form>
</div>
<!-- ENDIF -->
<div class="text-align: center;"> <fb:like href="{U_PAGE_URL}" show_faces="false" data-href="https://developers.facebook.com/docs/plugins/" data-width="500" font="arial" data-layout="button_count"></fb:like>
<div class="g-plusone" data-size="medium"></div>
Tweet
<!-- IF PAGINATION or TOTAL_POSTS -->
<div class="pagination">
<!-- IF U_VIEW_UNREAD_POST and not S_IS_BOT -->{L_VIEW_UNREAD_POST} • <!-- ENDIF -->{TOTAL_POSTS}
<!-- IF PAGE_NUMBER --><!-- IF PAGINATION --> • {PAGE_NUMBER} • <span>{PAGINATION}</span><!-- ELSE --> • {PAGE_NUMBER}<!-- ENDIF --><!-- ENDIF -->
</div>
<!-- ENDIF -->
</div>
</div>
<div class="clear"></div>
EDIT: I edited the code to look like this:
<div id="likebuttons"><fb:like href="{U_PAGE_URL}" show_faces="false"
data-href="https://developers.facebook.com/docs/plugins/" data-width="500" font="arial" data-layout="button_count"></fb:like>
<div class="g-plusone" data-size="medium"></div>
Tweet
</div>
And added CSS like this:
#likebuttons {
margin-left: 147px;
width: 350px;
background: #FFF;
text-align: center;
float: left;
padding: 2px;
-moz-border-radius: 0px;
-webkit-border-radius: 0px 0px 4px 4px;
border-radius: 0px 0px 4px 4px;
z-index: 10;
}
But the "Facebook" button is not in line with others 2. Can that be solved ? Thank you.
SOLVED: with the facebook button, added this code in CSS:
.fb_iframe_widget { vertical-align:top;}
There is a great website for this. I use it all the time:
Its called Share This:
http://www.sharethis.com/get-sharing-tools/#sthash.0aAa3jqv.dpbs
Get the code for the buttons on your website it will look something like this:
<span class='st_sharethis_hcount' displayText='ShareThis'></span>
<span class='st_facebook_hcount' displayText='Facebook'></span>
<span class='st_twitter_hcount' displayText='Tweet'></span>
<span class='st_linkedin_hcount' displayText='LinkedIn'></span>
<span class='st_pinterest_hcount' displayText='Pinterest'></span>
<span class='st_email_hcount' displayText='Email'></span>
Then with css you can style those respectively the way you want it.
UPDATE:
In your code you have an error:
<div class="text-align: center;">
text-align:center; is a style not a class... you need to first make to say
<div style="text-align: center;"> or make it a class and add styles in your css:
Next, remove all the in the code near the buttons.
Then add this to your css to style the FB like button and twitter to give it some margin:
.fb_iframe_widget {margin-right:25px;}
.twitter-share-button {margin-left:25px;}

Resources