What is initial scale, user-scalable, minimum-scale, maximum-scale attribute in meta tag?

They are viewport meta tags, and is most applicable on mobile browsers. width=device-width This means, we are telling to the browser “my website adapts to your device width”. initial-scale This defines the scale of the website, This parameter sets the initial zoom level, which means 1 CSS pixel is equal to 1 viewport pixel. This … Read more

Image loaded event in for ng-src in AngularJS

Here is an example how to call image onload http://jsfiddle.net/2CsfZ/2/ Basic idea is create a directive and add it as attribute to img tag. JS: app.directive(‘imageonload’, function() { return { restrict: ‘A’, link: function(scope, element, attrs) { element.bind(‘load’, function() { alert(‘image is loaded’); }); element.bind(‘error’, function(){ alert(‘image could not be loaded’); }); } }; }); … Read more

What is currently the best way to get a favicon to display in all browsers that support Favicons? [duplicate]

I go for a belt and braces approach here. I create a 32×32 icon in both the .ico and .png formats called favicon.ico and favicon.png. The icon name doesn’t really matter unless you are dealing with older browsers. Place favicon.ico at your site root to support the older browsers (optional and only relevant for older … Read more

Font Awesome icon inside text input element

Output: HTML: <input name=”txtName” id=”txtName”> <span class=”fa fa-info-circle errspan”></span> CSS: <style type=”text/css”> .errspan { float: right; margin-right: 6px; margin-top: -20px; position: relative; z-index: 2; color: red; } </style> (Or) Output: HTML: <div class=”input-wrapper”> <input type=”text” /> </div> CSS: <style type=”text/css”> .input-wrapper { display:inline-block; position: relative } .input-wrapper:after { font-family: ‘FontAwesome’; content: ‘\f274’; position: absolute; right: … Read more

Detecting WebP support

This is my solution – is taking around 6ms and I’m considering WebP is only a feature for a modern browser. Uses a different approach using canvas.toDataUrl() function instead of image as the way to detect the feature: function support_format_webp() { var elem = document.createElement(‘canvas’); if (!!(elem.getContext && elem.getContext(‘2d’))) { // was able or not … Read more

CSS strikethrough different color from text?

Yes, by adding an extra wrapping element. Assign the desired line-through color to an outer element, then the desired text color to the inner element. For example: <span style=”color:red;text-decoration:line-through”> <span style=”color:black”>black with red strikethrough</span> </span> …or… <strike style=”color:red”> <span style=”color:black”>black with red strikethrough<span> </strike> (Note, however, that <strike> is considered deprecated in HTML4 and obsolete … Read more