Tips for Cross Browser Compatibility

Developing and designing for every browser type can be a very challenging (some might say impossible) task. Every browser has its own unique inherent styling that (even with the use of a reset) can be difficult to override or get rid of completely, and not every browser supports some of the newer, cool CSS properties and techniques. For these reasons, it can be really tricky to make sure that your site designs look good and consistent (and functional!) across every single browser. While accounting for cross browser compatibility can be a daunting task, it can be made easier by applying the following tips.

Use Vendor Prefixes

This one is probably the most common way to avoid cross browser compatibility issues. A lot of CSS properties (particularly the newer ones) aren’t supported on most browsers, unless you use a vendor prefix. As a developer, you may want to cover all your bases when using a CSS property that isn’t widely supported (like, for example, the transition property) to make sure that your designs (or in the case of the transition property, your animated effects) actually work in every browser. The following is a list of the vendor prefixes that can be used for every browser:

[css]
-webkit-   //chrome, android, safari, ios
-o-   //opera
-moz-   //firefox
-ms- //internet explorer
[/css]

Here’s how you would use them in context:

[css]
div{
transition: all .5s ease;
-webkit-transition: all .5s ease;
-o-transition: all .5s ease;
-moz-transition: all .5s ease;
-ms-transition: all .5s ease;
}
[/css]

Don’t forget to include hyphens on either side of your prefix keyword!

Browser Hacks

If you want to target a specific property or style rule to behave a particular way based on the browser, there are a number of different CSS “hacks” that will allow you to target a specific browser and apply style rules to HTML elements only if they appear on one particular browser. This works well when you’re trying to compensate for a style or property that might work on all browsers except for one. This way, you can use a hack to single out a specific browser and change the styling only for that one to make sure your design doesn’t look funky or your functionality isn’t compromised without the unsupported CSS property. Check out the list of hacks for common browsers below:

[css]
/* Internet Explorer Versions 9+ */
@<span class="hljs-keyword">media</span> screen and (min-width:<span class="hljs-number">0</span>\<span class="hljs-number">0</span>) {
<span class="hljs-selector-class">.<strong>yourElement</strong></span> {
font-size: 12px;
}
}

/* Firefox Versions 3+ */
<span class="hljs-selector-tag">html</span>><span class="hljs-comment">/**/</span><span class="hljs-selector-tag">body</span> <span class="hljs-selector-class">.<strong>yourElement</strong></span>, <span class="hljs-selector-tag">x</span><span class="hljs-selector-pseudo">:-moz-any-link</span>, <span class="hljs-selector-tag">x</span><span class="hljs-selector-pseudo">:default</span> {
<span class="hljs-attribute">font-size: 12px;</span><span class="hljs-meta">
</span>}

/* Chrome and Safari */
@<span class="hljs-keyword">media</span> screen and (-webkit-min-device-pixel-ratio:<span class="hljs-number">0</span>) {
<span class="hljs-selector-class">.<strong>yourElement</strong></span> {
<span class="hljs-attribute">font-size</span>: 12px;<span class="hljs-number">
</span>}
}
[/css]

Make sure you insert the name of the element you’d like to single out in the spot where it’s written .yourElement in bold.

Use CSS @supports Rule

The CSS @supports allows you to wrap your CSS rules within the @supports query so that the rule will only be applied if it’s supported on a particular browser. If a rule isn’t supported, it’ll get skipped over as if the rule weren’t there, which can really come in handy for those properties you want to use but don’t want to look terrible if they happen to not be supported on a browser. Here’s how you would use it in context:

[css]
@supports(transition: all .5s ease){
div{
transition: all .5s ease;
}
}
[/css]

In order to use @supports, you’ll have to pass through the CSS rule you want to account for as a parameter, and then the code will take care of the rest.

HTML5 Fullscreen Background Video with CSS and JS (Plugin/Library)

Fullscreen background videos that autoplay right when the webpage loads (above the fold) has become quite a popular trend these days. Personally I think a fullscreen good quality video that autoplays does increases engagement for the users/customers. It should be kept in mind that the story of the video must be relevant to the brand. These days we’re surrounded by loads of videos on social networks like FB and Twitter as well which autoplay (but is muted of course). Analytical studies have also reported higher engagement due to this.

Continue reading “HTML5 Fullscreen Background Video with CSS and JS (Plugin/Library)”

Hello world!

Hello from Yet Another Blogger! My name is Rishabh, a freelance web developer from India. I’ll use this blog to post some tips and tricks that I learn while working on various projects (personal or for clients). Some articles might also get into the details of several interesting topics, but I’ll try to keep them precise so that you can read quick, learn and get to work.

Quite excited about this!

All You Need to Know About Cloudflare

Located in San Francisco, United States, Cloudflare provides Content Delivery Network (CDN) services, internet security, distributed domain network services, internet security and Distributed Denial of Service (DDoS) mitigation services. One of the largest internet networks in the world, Cloudflare works closely with website owners, bloggers, non-profit organizations and others.

History

It was in 2009 that Matthew Price and Michelle Zatlyn founded this company. Initially, the focus of Cloudflare was to secure email owners from pernicious attacks. Over a period, the founders realized that slow speeds of websites had a direct correlation with internet security, and this is how the modern version of Cloudflare was born.
Today, this product helps accelerate internet applications, mobile experiences and ensures the availability of applications. Cloudflare works very closely with SaaS, E-commerce companies, publishers, and the public sector. It is well integrated with IBM Cloud, WordPress, WP Engine, Rackspace, Magento, Google Cloud, Acquia, Microsoft Azure, and Kubermetes.

As of now, this company is used by 8 million website owners to make their internet presence better, and more secure.

1. Content Delivery Network services- Cloudflare helps websites load up quickly. When a visitor types the name of a website inside the search bar and presses ENTER, Cloudflare compresses the delivery time between the servers to the visitor.

On the internet platform, information is stored in several geographically remote servers. A CDN like Cloudflare figures out the shortest path for the data from the servers to the end user. If you have an E-commerce website, having a CDN is crucial for conversions. Many web hosting providers have CDNs included in their plans. Nevertheless, you can also ask your hosting reseller for this functionality while configuring your website.

2. Internet Security – Cloudflare also makes your website, APIs, and stored data safe and secure against bots, denial of service attacks and data breaches.
A denial of service attack is triggered when a website is attacked by anonymous visitors from several locations to bring it down. These attackers cannot be identified at all and their sole purpose is to make the attacked website completely non-functional. Cloudflare has 180 data centers in 76 countries and has a cumulative capacity of 30 terabytes. This capacity is used by Cloudflare to dilute the DDos attacks.
Coming to security, Cloudflare has a quite a few products that safeguard your online presence. Some of them are:

a)Argo Tunnel- This lightweight product creates a virtual tunnel between your origin web server and Cloudflare’s nearest data center without exposing any inbound ports.

b) SSL/ TLS encryption- Cloudflare’s Transport Security Level encryption establishes HTTPS connections between the visitors and origin servers thereby preventing man-in-the middle attacks , packet sniffing etc. This product also displays trust warnings to visitors periodically.

Is Cloudflare really this good?

According to this internet security company, websites that use Cloudflare load twice as fast, and use 60% less bandwidth. Another thing that goes in favour of this product is that it merges internet security and content delivery effortlessly.
Pricing for this product starts free. As you begin discovering its benefits, you may like to subscribe to Cloudflare premium plans.

An introduction to CherryPy, a lightweight Python web framework

CherryPy is an open source, fast, and stable python web framework that allows the developers to build the web applications. The developers can build the web applications as the way they would build the other object-oriented python programs. Many developers still haven’t heard this simple, Continue reading “An introduction to CherryPy, a lightweight Python web framework”

What is the main difference between an absolute and a relative path on Unix based systems

Those who have made use of the cd command through a terminal application on their own operating system, have probably made use of a relative path, an absolute one or both of them. Based on my personal experience with the command line, the cd command is a Unix based one and it helps the user to navigate their filesystem through the terminal application. The cd command takes the path of the file as an argument.

For example, the following command helps the user to change their current working directory to the Desktop.

Continue reading “What is the main difference between an absolute and a relative path on Unix based systems”