I would like to make a gif clickable to a new page. I'm not sure what code to include and have tried many options that did not work out. The following is part of the code:
<div class="col-md-7 col-sm-4 col-xs-12" style="background-image: url('xx.gif'); background-size: cover; background-position: 50% 50%;" id="xx" data-image-url="xx.gif">
Thank you in advance!
Welcome to SO. HTML link use the <a> tag with the intended URL in the href property. Wrap your GIF in an <a> tag to make it clickable.
I am using Angular with Material
<button mat-icon-button><mat-icon svgIcon="thumb-up"></mat-icon>Start Recording</button>
I am trying to add an icon to button, but I can't figure out how to do it, and can't find documentation for this.
https://material.angular.io/components/button/api
looking the docs, there is this:
that button has the following html:
<a _ngcontent-c1="" aria-label="Angular Material" class="docs-button mat-button" mat-button="" routerlink="/" tabindex="0" aria-disabled="false" href="/"><span class="mat-button-wrapper">
<img _ngcontent-c1="" alt="angular" class="docs-angular-logo" src="../../../assets/img/homepage/angular-white-transparent.svg">
<span _ngcontent-c1="">Material</span>
</span> <div class="mat-button-ripple mat-ripple" matripple=""></div><div class="mat-button-focus-overlay">
</div>
</a>
is that the right way to do it?
Just add the <mat-icon> inside mat-button or mat-raised-button. See the example below. Note that I am using material icon instead of your svg for demo purpose:
<button mat-button>
<mat-icon>mic</mat-icon>
Start Recording
</button>
OR
<button mat-raised-button color="accent">
<mat-icon>mic</mat-icon>
Start Recording
</button>
Here is a link to stackblitz demo.
All you need to do is add the mat-icon-button directive to the button element in your template. Within the button element specify your desired icon with a mat-icon component.
You'll need to import MatButtonModule and MatIconModule in your app module file.
From the Angular Material buttons example page, hit the view code button and you'll see several examples which use the material icons font, eg.
<button mat-icon-button>
<mat-icon aria-label="Example icon-button with a heart icon">favorite</mat-icon>
</button>
In your case, use
<mat-icon>thumb_up</mat-icon>
As per the getting started guide at https://material.angular.io/guide/getting-started, you'll need to load the material icon font in your index.html.
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
Or import it in your global styles.scss.
#import url("https://fonts.googleapis.com/icon?family=Material+Icons");
As it mentions, any icon font can be used with the mat-icon component.
My preference is to utilize the inline attribute. This will cause the icon to correctly scale with the size of the button.
<button mat-button>
<mat-icon inline=true>local_movies</mat-icon>
Movies
</button>
<!-- Link button -->
<a mat-flat-button color="accent" routerLink="/create"><mat-icon inline=true>add</mat-icon> Create</a>
I add this to my styles.css to:
solve the vertical alignment problem of the icon inside the button
material icon fonts are always a little too small compared to button text
button.mat-button .mat-icon,
a.mat-button .mat-icon,
a.mat-raised-button .mat-icon,
a.mat-flat-button .mat-icon,
a.mat-stroked-button .mat-icon {
vertical-align: top;
font-size: 1.25em;
}
Add to app.module.ts
import {MatIconModule} from '#angular/material/icon';
& link in your global index.html.
the above CSS can be written in SASS as follows (and it actually includes all button types, instead of just button.mat-button)
button,
a {
&.mat-button,
&.mat-raised-button,
&.mat-flat-button,
&.mat-stroked-button {
.mat-icon {
vertical-align: top;
font-size: 1.25em;
}
}
}
The Material icons use the Material icon font, and the font needs to be included with the page.
Here's the CDN from Google Web Fonts:
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
I am trying to make a button in jQuery Mobile that has svg as background image, and can't get it right. I don't want icon button, I want button that has image as background. Here is m< code
<div class="ui-block-a">
<a data-role="button" class="red-button" href="login.html">LOGIN</a>
</div>
.red-button {
background-image: url(../img/buttons/button-red.svg) !important;
}
Can anyone please tell me what is wrong here. Thanks.
Sorry if this is a benign question but still new to ASP MVC3 - what is the best syntax for using an image as a link? It needs to navigate to the Index.cshtml page of another Controller (called Home).
What I have below causes the image to completely disappear:
<a href="#Url.Action("Index", "Home")><img src="#Url.Content("~/Content/images/Monet3.png")" id="MonetSig" /></a>
I think that there is a closing " missing after #Url.Action("Index", "Home") it might be the problem
I would use CSS to give the anchor a background image. This way you can easily change the image for mobile or tablets:
CSS:
#MonetSig {
display: block;
width:100px; /* change this to your image width and height */
height:100px;
background: url('../images/Monet3.png') no-repeat;
}
Html:
<a id="MonetSig" href="#Url.Action("Index", "Home")"></a>
I'm new to jQuery mobile and Phonegap. Sorry if this is not the place to ask for this question.
I'm trying to put a custom image inside a button (not the small icon to the left or to the right but a bigger image).
I use the following code:
<a data-role="button" data-corners="false" data-shadow="false" >
<img src="images/car.png" />
</a>
In the rendering, the image is not centered but goes right.
I have also tried using a class="car-icon" and the corresponding css3 rule:
.ui-icon-car-icon {
background-image: url("car.png");
}
.ui-icon-car-icon {
text-align: center;
}
Any help will be greatly appreciated (I have spent the whole night trying to fix this).
Thanks in advance.
Try using the thing, like this: http://jsfiddle.net/den232/sFupf/
<button><img src="http://doc.jsfiddle.net/_downloads/jsfiddle-logo.png" height=35 width=35 ></button>
Good luck!
You can try setting your image as the background of your link <a>, and centering it using background-position: center center;:
HTML:
<a id="mybutton" data-role="button" data-corners="false" data-shadow="false" > </a>
CSS:
#mybutton {
background: url('car.png') no-repeat scroll 0 0 transparent;
background-position: center center;
}