Image is displaying as button on iOS - ios

I am having an issue with images displaying as buttons (with the title text as the text of the button) in the iPhone 5 browser. I have tried GIF, PNG and JPG file types.. all with the same effect. It is not happening with all images... but one consistence appear to be
Any advise?
Code example:
<a href="/index.php?main_page=checkout_shipping">
<img width="159" height="27" title=" Proceed to Checkout " alt="Proceed to Checkout" src="includes/templates/template_default/buttons/english/button_checkout.jpg">
</a>
Screenshot:

It seems that the UIWebView is considering your alt as the data, so, dispaying a text instead of the image. Verify if your image really exists in that folder or, try removing the alt from the a href tag o see what happens.

Try this one. Give an ID to tag and style them with css.
HTML
<a id="checkout" href="/index.php?main_page=checkout_shipping">
<img width="159" height="27" title=" Proceed to Checkout " alt="Proceed to Checkout" src="includes/templates/template_default/buttons/english/button_checkout.jpg" />
</a>
CSS
a#checkout {
float:right;
margin:10px;
width:159px;
height:27px;
text-decoration:none;
border:none;
outline:none;
}
a#checkout img{
float:right;
width:159px;
height:27px;
border:none;
outline:none;
}

Related

How to make a gif clickable to a new page?

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.

How to add icon to mat-icon-button

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">

Make image button in jQuery Mobile

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.

ASP MVC3 Use image as link to a different View/Controller

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>

How to center an image inside a button, using jQuery Mobile?

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;
}

Resources