{"componentChunkName":"component---src-pages-author-author-yaml-id-js","path":"/author/team-login-radius/","result":{"data":{"allMarkdownRemark":{"edges":[{"node":{"id":"62a46b49-8cee-5224-b664-7b1db62e4f3c","html":"<p>This blog is a short guide on implementing AWS Lambda and SQS together. First we’ll introduce these technologies and explain why they work well together, then walkthrough some configurations and invocation using a simple Nodejs script.</p>\n<p><img src=\"/ee2d9bd3978930dc685480ceac45286e/blog-aws-lambda-sqs-1.webp\"></p>\n<p><strong>What are they?</strong>\nAWS Lambda is a popular choice in serverless computing. As an event-driven platform, AWS Lambda requires users to configure event sources in order to run a function. Their built-in support for many AWS services like S3 and SQS as event sources allow for relatively simple configuration. Note that Lambda functions can also be triggered via HTTP(S) by using AWS API Gateway service.</p>\n<p>AWS SQS (Simple Queue Service) is a queue service with 2 types: standard and FIFO. The major difference is that standard queues guarantee “at-least once” delivery of its messages, while FIFO queues guarantee “exactly-once” delivery. FIFO queues, however, provide lower maximum throughput than standard.</p>\n<p>As previously mentioned, AWS SQS can be an event source for AWS Lambda. This means that when a message is added to the queue, the configured Lambda function will be invoked with an event containing this message.</p>\n<p><img src=\"/5e7303903f14f7a18b0b90dd5b9a194f/blog-aws-lambda-sqs-2.webp\"></p>\n<p><strong>But why use them together?</strong><br>\nCommon reasons include better handling Lambda function invocations and errors. For function invocations, the default concurrency limit is 1000. If a function has reached this limit, any additional invocations will fail with a throttling error. However, with SQS as an event source, events resulting in throttling errors are automatically retried based on set configs. This prevents the loss of events due to unexpected jumps in usage. Additionally, dead-letter queues (DLQ) can be configured as a place where failed events go, to avoid retrying indefinitely. Failed events in DLQ can then be sent somewhere like a DB for analysis.</p>\n<p>One limitation for many use cases was the “at-least once” delivery model of events with standard queues. Essentially, there was no guarantee that an event will only be delivered once to a consuming Lambda function. In cases where each event can strictly only be processed once, one would have to employ various strategies resulting in higher overhead and complexity. But, this is no longer an issue because recently the AWS team added support for FIFO queues as event sources to Lambda functions.</p>\n<p><strong>Walkthrough</strong><br>\nLet’s set up a basic “Hello World” application with SQS and Lambda.</p>\n<p>1. Starting with SQS, add a standard queue.</p>\n<p>2. Now, add a Lambda function:</p>\n<p><img src=\"/ef2b599ea14dbf5ffd11d05abefad149/blog-aws-lambda-sqs-3-1024x447.webp\"></p>\n<p>3. Create a new execution role with the following configs:<br>\na. Trusted Entity: Lambda<br>\nb. Permissions: AWSLambdaBasicExecutionRole; AWSLambdaSQSQueueExecutionRole</p>\n<p><img src=\"/5362ac9bedede42c761b07d67c387ed2/blog-aws-lambda-sqs-4.webp\"></p>\n<p>4. Use newly created role in Lambda function. Remember to save (top right).</p>\n<p><img src=\"/b722125958d83a73928cc26a9b9abfb0/blog-aws-lambda-sqs-5.webp\"></p>\n<p>5. Add a trigger:<br>\na. Batch size set to 1, so the Lambda Function will process 1 message at a time.</p>\n<p><img src=\"/09222801a7c08c6f77517d32730b5b95/blog-aws-lambda-sqs-6.webp\"></p>\n<p>6. Programmatically enqueue a message into SQS with the following code in Nodejs:</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"javascript\" data-index=\"0\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk4\">const</span><span class=\"mtk1\"> </span><span class=\"mtk12\">AWS</span><span class=\"mtk1\"> = </span><span class=\"mtk11\">require</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&quot;aws-sdk&quot;</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">AWS</span><span class=\"mtk1\">.</span><span class=\"mtk12\">config</span><span class=\"mtk1\">.</span><span class=\"mtk11\">update</span><span class=\"mtk1\">({</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">region:</span><span class=\"mtk1\"> </span><span class=\"mtk17\">&lt;</span><span class=\"mtk10\">AWS_SQS_REGION</span><span class=\"mtk17\">&gt;</span><span class=\"mtk1\">, // TODO</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  accessKeyId: </span><span class=\"mtk17\">&lt;</span><span class=\"mtk10\">AWS_ACCESS_KEY_ID</span><span class=\"mtk17\">&gt;</span><span class=\"mtk1\">, // TODO</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  secretAccessKey: </span><span class=\"mtk17\">&lt;</span><span class=\"mtk10\">AWS_SECRET_ACCESS_KEY</span><span class=\"mtk17\">&gt;</span><span class=\"mtk1\"> // TODO</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">});</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">const sqs = new AWS.SQS(</span><span class=\"mtk4\">{</span><span class=\"mtk1\"> </span><span class=\"mtk12\">apiVersion</span><span class=\"mtk1\">: </span><span class=\"mtk8\">&quot;2012-11-05&quot;</span><span class=\"mtk1\"> </span><span class=\"mtk4\">}</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">sqs.sendMessage(</span><span class=\"mtk4\">{</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">MessageBody</span><span class=\"mtk1\">: </span><span class=\"mtk10\">JSON</span><span class=\"mtk1\">.</span><span class=\"mtk11\">stringify</span><span class=\"mtk1\">({</span><span class=\"mtk12\">hello:</span><span class=\"mtk1\"> </span><span class=\"mtk8\">&quot;world&quot;</span><span class=\"mtk1\">}),</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">QueueUrl</span><span class=\"mtk1\">: </span><span class=\"mtk17\">&lt;</span><span class=\"mtk10\">AWS_SQS_URL</span><span class=\"mtk17\">&gt;</span><span class=\"mtk1\"> // TODO</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}, (err, data) =&gt; (err) ? console.log(&quot;Error&quot;, err) : console.log(&quot;Success&quot;, data.MessageId));</span></span></code></pre>\n<p>a. Create package.json with `npm init`<br>\nb. Install aws sdk dependency with `npm i aws-sdk --save`<br>\nc. Fill in your specific AWS account details. Find AWS_SQS_URL by selecting the queue you created, while AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY require creating a new IAM user with programmatic access. This user also needs permission to push messages into SQS.<br>\nd. Run script with `node app.js`<br>\ne. Navigate to Monitoring tab in your Lambda function, the invocations graph should have a new data point (may take a few minutes to update).</p>\n<p><img src=\"/9fb817ec026be608972f6f9df8836011/blog-aws-lambda-sqs-7.webp\"></p>\n<style class=\"grvsc-styles\">\n  .grvsc-container {\n    overflow: auto;\n    -webkit-overflow-scrolling: touch;\n    padding-top: 1rem;\n    padding-top: var(--grvsc-padding-top, var(--grvsc-padding-v, 1rem));\n    padding-bottom: 1rem;\n    padding-bottom: var(--grvsc-padding-bottom, var(--grvsc-padding-v, 1rem));\n    border-radius: 8px;\n    border-radius: var(--grvsc-border-radius, 8px);\n    font-feature-settings: normal;\n  }\n  \n  .grvsc-code {\n    display: inline-block;\n    min-width: 100%;\n  }\n  \n  .grvsc-line {\n    display: inline-block;\n    box-sizing: border-box;\n    width: 100%;\n    padding-left: 1.5rem;\n    padding-left: var(--grvsc-padding-left, var(--grvsc-padding-h, 1.5rem));\n    padding-right: 1.5rem;\n    padding-right: var(--grvsc-padding-right, var(--grvsc-padding-h, 1.5rem));\n  }\n  \n  .grvsc-line-highlighted {\n    background-color: var(--grvsc-line-highlighted-background-color, transparent);\n    box-shadow: inset var(--grvsc-line-highlighted-border-width, 4px) 0 0 0 var(--grvsc-line-highlighted-border-color, transparent);\n  }\n  \n  .dark-default-dark {\n    background-color: #1E1E1E;\n    color: #D4D4D4;\n  }\n  .dark-default-dark .mtk4 { color: #569CD6; }\n  .dark-default-dark .mtk1 { color: #D4D4D4; }\n  .dark-default-dark .mtk12 { color: #9CDCFE; }\n  .dark-default-dark .mtk11 { color: #DCDCAA; }\n  .dark-default-dark .mtk8 { color: #CE9178; }\n  .dark-default-dark .mtk17 { color: #808080; }\n  .dark-default-dark .mtk10 { color: #4EC9B0; }\n</style>","frontmatter":{"title":"Working with AWS Lambda and SQS","author":{"id":"Team LoginRadius","github":"LoginRadius","avatar":null},"date":"February 13, 2020","updated_date":null,"tags":["Engineering","General"],"coverImage":{"childImageSharp":{"fluid":{"aspectRatio":2.127659574468085,"src":"/static/ee2d9bd3978930dc685480ceac45286e/b594c/blog-aws-lambda.webp","srcSet":"/static/ee2d9bd3978930dc685480ceac45286e/61e93/blog-aws-lambda.webp 200w,\n/static/ee2d9bd3978930dc685480ceac45286e/1f5c5/blog-aws-lambda.webp 400w,\n/static/ee2d9bd3978930dc685480ceac45286e/b594c/blog-aws-lambda.webp 448w","sizes":"(max-width: 448px) 100vw, 448px"}}}},"fields":{"authorId":"Team LoginRadius","slug":"/engineering/working-with-aws-lambda-and-sqs/"}}},{"node":{"id":"bd0156a7-3d99-58da-8516-f1e9925663c6","html":"<p><strong>Overview</strong>  </p>\n<p>The “reconciliation” algorithm in React is how the decision to re-render the component is made. In the browser, DOM manipulation is expensive and time consuming, both in mounting and unmounting. Part of what makes React very performant is its reconciliation algorithm.  </p>\n<p>In short, it watches closely for differences, and only updates the DOM when necessary and tries to update only the parts which need to be changed.  </p>\n<p><strong>The “Virtual DOM”</strong>  </p>\n<p>The Virtual DOM is a theoretical DOM tree generated by React when a change is made to a component’s state. This is modeled after the state of your application upon modification of the state, for example, after calling this.setState(). React uses what is called a “snapshot” to make this comparison and analysis between the DOM before the update, and the DOM after. This is the point in time when React utilizes its reconciliation algorithm.  </p>\n<p>Updating the Virtual DOM is much faster than the real DOM, since the browser doesn’t need to show a visualization of it.  </p>\n<p><strong>How updates are determined</strong>  </p>\n<p>The reconciliation algorithm is run whenever the component level state is updated. It analyzes the current DOM with the Virtual DOM, in order to determine which changes need to be made to the real DOM. After this step, it has determined which DOM nodes on your application require updates, and it calls the render method.  </p>\n<p><strong>Effect on DOM elements and their attributes</strong>  </p>\n<p>The reconciliation algorithm does not only look at whole DOM elements, it also looks at individual attributes. You can think of the difference as a PUT request vs. a PATCH request, where it only updates the parts which have changed, rather than updating the entire object if there was a change.  </p>\n<p>While it doesn’t unmount and remount the entire element if it doesn’t have to, sometimes it <em>does</em> have to. An example of this would be if you render an element of a different type.  </p>\n<p>Suppose you wanted to switch between two components or elements, perhaps for conditional rendering. This would result in a full unmounting of the component, regardless of whether or not they contain the same child nodes.  </p>\n<p>This differs from switching attributes on the same type of elements, an example of which might be dynamic class names, based on component state. In this scenario, the DOM element is <em>not</em> destroyed, and only the modified attributes are changed. This is useful because it performs minimal operations on the DOM, which as we know, is more resource-intensive than standard object operations.  </p>\n<p><strong>Keys and rerenders</strong>  </p>\n<p>The \"key\" attribute in React can be used to mark whether or not a DOM node is stable. You may have seen a message in the console if you’ve ever attempted to map over a collection and return a JSX element each iteration. This is because the reconciliation algorithm uses the keys to determine if the content has changed, and not including a key may cause unexpected behaviour. For this reason, the keys should be unique so that reconciliation can recognize and identify which elements are stable, and which elements are not.  </p>\n<p>Suppose that you have a list of items, which is derived from an array. If you were to splice an item into the middle of it, that will change all of the indices of the subsequent items. In this scenario, since the keys will not be a stable, unique representation of each item, React can end up mutating the unintended item, which can cause major bugs.  </p>\n<p>A detailed explanation of keys can be found on the official React docs:</p>\n<p><a href=\"https://reactjs.org/docs/lists-and-keys.html\">Lists and Keys</a></p>\n<p><a href=\"https://reactjs.org/docs/reconciliation.html#keys\">Reconciliation-Keys</a></p>\n<p>For an in-depth exploration of how and why reconciliation was implemented, please visit the official React docs:</p>\n<p><a href=\"https://reactjs.org/docs/reconciliation.html\">Reconciliation</a></p>\n<style class=\"grvsc-styles\">\n  .grvsc-container {\n    overflow: auto;\n    -webkit-overflow-scrolling: touch;\n    padding-top: 1rem;\n    padding-top: var(--grvsc-padding-top, var(--grvsc-padding-v, 1rem));\n    padding-bottom: 1rem;\n    padding-bottom: var(--grvsc-padding-bottom, var(--grvsc-padding-v, 1rem));\n    border-radius: 8px;\n    border-radius: var(--grvsc-border-radius, 8px);\n    font-feature-settings: normal;\n  }\n  \n  .grvsc-code {\n    display: inline-block;\n    min-width: 100%;\n  }\n  \n  .grvsc-line {\n    display: inline-block;\n    box-sizing: border-box;\n    width: 100%;\n    padding-left: 1.5rem;\n    padding-left: var(--grvsc-padding-left, var(--grvsc-padding-h, 1.5rem));\n    padding-right: 1.5rem;\n    padding-right: var(--grvsc-padding-right, var(--grvsc-padding-h, 1.5rem));\n  }\n  \n  .grvsc-line-highlighted {\n    background-color: var(--grvsc-line-highlighted-background-color, transparent);\n    box-shadow: inset var(--grvsc-line-highlighted-border-width, 4px) 0 0 0 var(--grvsc-line-highlighted-border-color, transparent);\n  }\n  \n</style>","frontmatter":{"title":"React's Reconciliation Algorithm","author":{"id":"Team LoginRadius","github":"LoginRadius","avatar":null},"date":"December 03, 2019","updated_date":null,"tags":["React"],"coverImage":{"childImageSharp":{"fluid":{"aspectRatio":2.2988505747126435,"src":"/static/3b049b298332c75b5f5768c066fe56fa/58556/react-fiber.webp","srcSet":"/static/3b049b298332c75b5f5768c066fe56fa/61e93/react-fiber.webp 200w,\n/static/3b049b298332c75b5f5768c066fe56fa/1f5c5/react-fiber.webp 400w,\n/static/3b049b298332c75b5f5768c066fe56fa/58556/react-fiber.webp 800w,\n/static/3b049b298332c75b5f5768c066fe56fa/e30b5/react-fiber.webp 1000w","sizes":"(max-width: 800px) 100vw, 800px"}}}},"fields":{"authorId":"Team LoginRadius","slug":"/engineering/reacts-reconciliation-algorithm/"}}},{"node":{"id":"af623550-ef1d-58c6-8038-d12c7323e99d","html":"<p>This blog post goes over how you can connect your SAAS/web application with the Azure AD world. Let’s take a look at how Azure AD works as an identity provider to provide your users with the ability to log in. e.g if anyone using Office 365, able to log on with their standard account or a federated one.</p>\n<p>Windows Azure provides a number of identity-based technologies to support such kind of requirements. As a means of illustrating this, we’ll show an example using Azure AD as an Identity Provider (IdP), connecting up to the LoginRadius SAAS application using the LoginRadius Admin Console.</p>\n<ul>\n<li>Log in to the Azure Portal.</li>\n<li>On the Azure active directory tab, click on the App registrations tab.  From the top of the screen, create a new application by clicking on \"New application registration\".</li>\n</ul>\n<p><img src=\"/d5a14d88388c9686e4de16d8a8538bb6/1.webp\"></p>\n<ul>\n<li>Give your SaaS/Web application a name (company name Demo).  Using the drop-down, select the type of application i.e Web Application / Web API.</li>\n<li>For Sign-On URL fill in the Assertion Consumer Service (ACS) URL for the Service Provider</li>\n</ul>\n<p><img src=\"/3d600c1deb640722cc1b96d6334abba2/2.webp\"></p>\n<ul>\n<li>Go to the App setting at the top of the page and fill in the required fields</li>\n<li>Go to the endpoints at the top of the application registration page and use these app endpoints to set up the azure ad with your saas application.</li>\n</ul>\n<p><img src=\"/9678949d8b19c52a1fa38ba8e896e458/A-1.webp\"></p>\n<p>Here are the meanings of the terms, we have used above: </p>\n<p><strong>Sign-On Url</strong>: This is where you want to send users to when accessing the \"application\". </p>\n<p><strong>Reply URL</strong>: It's the Reply URL which is the address to which Azure AD will send the SAML authentication response.</p>\n<p>On the Service Provider side, the metadata from the tenant, Azure Identity Provider needs to be parsed and added to the configuration file. This is done by downloading the Azure IdP metadata file directly, e.g.</p>\n<p><code>https://login.microsoftonline.com/&#x3C;AzureTenantID>/federationmetadata/2007-06/federationmetadata.xml</code></p>\n<p>This is all you need to know to go about creating a new application on the Azure portal and use Azure Ad as an Identity provider for login. With these and a number of services, Azure offers a solid convergence point for brokering connections with your web applications and workspaces.</p>\n<style class=\"grvsc-styles\">\n  .grvsc-container {\n    overflow: auto;\n    -webkit-overflow-scrolling: touch;\n    padding-top: 1rem;\n    padding-top: var(--grvsc-padding-top, var(--grvsc-padding-v, 1rem));\n    padding-bottom: 1rem;\n    padding-bottom: var(--grvsc-padding-bottom, var(--grvsc-padding-v, 1rem));\n    border-radius: 8px;\n    border-radius: var(--grvsc-border-radius, 8px);\n    font-feature-settings: normal;\n  }\n  \n  .grvsc-code {\n    display: inline-block;\n    min-width: 100%;\n  }\n  \n  .grvsc-line {\n    display: inline-block;\n    box-sizing: border-box;\n    width: 100%;\n    padding-left: 1.5rem;\n    padding-left: var(--grvsc-padding-left, var(--grvsc-padding-h, 1.5rem));\n    padding-right: 1.5rem;\n    padding-right: var(--grvsc-padding-right, var(--grvsc-padding-h, 1.5rem));\n  }\n  \n  .grvsc-line-highlighted {\n    background-color: var(--grvsc-line-highlighted-background-color, transparent);\n    box-shadow: inset var(--grvsc-line-highlighted-border-width, 4px) 0 0 0 var(--grvsc-line-highlighted-border-color, transparent);\n  }\n  \n</style>","frontmatter":{"title":"Azure AD as an Identity provider","author":{"id":"Team LoginRadius","github":"LoginRadius","avatar":null},"date":"May 30, 2019","updated_date":null,"tags":["Engineering","Authentication","AzureAD"],"coverImage":{"childImageSharp":{"fluid":{"aspectRatio":1,"src":"/static/cfb639b3060cd188a04597240fb1e37d/a3e81/TN0lxUr0.webp","srcSet":"/static/cfb639b3060cd188a04597240fb1e37d/61e93/TN0lxUr0.webp 200w,\n/static/cfb639b3060cd188a04597240fb1e37d/1f5c5/TN0lxUr0.webp 400w,\n/static/cfb639b3060cd188a04597240fb1e37d/a3e81/TN0lxUr0.webp 512w","sizes":"(max-width: 512px) 100vw, 512px"}}}},"fields":{"authorId":"Team LoginRadius","slug":"/engineering/azure-ad-as-an-identity-provider/"}}},{"node":{"id":"da86ba01-0b41-5aff-b82b-a74c330bfbfd","html":"<p>While creating Lead Generation form at LoginRadius, Marketers wanted to sure that visitors enter business emails. To that end, I created a list in JSON format to block free mail providers like Gmail, Outlook etc.</p>\n<p>Business mail validator makes sure users enters only business emails in submission forms on a web page. User can’t enter with free email’s that provided by the third party (free email) service provider.</p>\n<p>Ex. Gmail.com, Yahoo.com, Yahoomail.com, Rediff.com etc.</p>\n<p>We can classified business email validation in two ways.</p>\n<h3 id=\"1-client-side\" style=\"position:relative;\"><a href=\"#1-client-side\" aria-label=\"1 client side permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><strong>1. Client side</strong></h3>\n<p>In client side validation we use javascript(js) OR jQuery to validate entered the email at time of submission the html form. So we can follow the following steps to validate it on client side.</p>\n<ul>\n<li>First of all create a simple html page with name emailvalidate.html</li>\n<li>\n<p>Add jQuery script on head section</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"js\" data-index=\"0\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk17\">&lt;</span><span class=\"mtk4\">script</span><span class=\"mtk1\"> </span><span class=\"mtk12\">src</span><span class=\"mtk1\">=</span><span class=\"mtk8\">&quot;https://ajax.googleapis.com/ajax/libs/jquery/3.2.0/jquery.min.js&quot;</span><span class=\"mtk17\">&gt;&lt;/</span><span class=\"mtk4\">script</span><span class=\"mtk17\">&gt;</span></span></code></pre>\n</li>\n<li>Call json file content in a script variable like</li>\n</ul>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"js\" data-index=\"1\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk17\">&lt;</span><span class=\"mtk4\">script</span><span class=\"mtk17\">&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    var emailValidator = </span><span class=\"mtk4\">{</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk8\">&quot;123.com&quot;</span><span class=\"mtk1\">: </span><span class=\"mtk4\">true</span><span class=\"mtk1\">,</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk8\">&quot;123box.net&quot;</span><span class=\"mtk1\">: </span><span class=\"mtk4\">true</span><span class=\"mtk1\">,</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk8\">&quot;123india.com&quot;</span><span class=\"mtk1\">: </span><span class=\"mtk4\">true</span><span class=\"mtk1\">,</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        …………………….</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        …………………..</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk8\">&quot;ymail.com&quot;</span><span class=\"mtk1\">: </span><span class=\"mtk4\">true</span><span class=\"mtk1\">,</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk8\">&quot;yandex.com&quot;</span><span class=\"mtk1\">: </span><span class=\"mtk4\">true</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk4\">}</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk17\">&lt;/</span><span class=\"mtk4\">script</span><span class=\"mtk17\">&gt;</span></span></code></pre>\n<p>Our complete list is available <a href=\"https://github.com/LoginRadius/business-email-validator/blob/master/src/freeEmailService.json\">here</a></p>\n<ul>\n<li>Add validation form function after you have added above code.</li>\n</ul>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"js\" data-index=\"2\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk17\">&lt;</span><span class=\"mtk4\">script</span><span class=\"mtk17\">&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">function validateForm(id) </span><span class=\"mtk4\">{</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">                            </span><span class=\"mtk12\">var</span><span class=\"mtk1\"> </span><span class=\"mtk12\">emailValue</span><span class=\"mtk1\"> = </span><span class=\"mtk11\">jQuery</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&#39;#&#39;</span><span class=\"mtk1\">+</span><span class=\"mtk12\">id</span><span class=\"mtk1\">).</span><span class=\"mtk11\">val</span><span class=\"mtk1\">();</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">                            </span><span class=\"mtk12\">var</span><span class=\"mtk1\"> </span><span class=\"mtk12\">emailArray</span><span class=\"mtk1\"> = </span><span class=\"mtk12\">emailValue</span><span class=\"mtk1\">.</span><span class=\"mtk11\">split</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&quot;@&quot;</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">                            </span><span class=\"mtk12\">var</span><span class=\"mtk1\"> </span><span class=\"mtk12\">provider</span><span class=\"mtk1\"> = </span><span class=\"mtk12\">emailArray</span><span class=\"mtk1\">[</span><span class=\"mtk7\">1</span><span class=\"mtk1\">] ? </span><span class=\"mtk12\">emailArray</span><span class=\"mtk1\">[</span><span class=\"mtk7\">1</span><span class=\"mtk1\">] : </span><span class=\"mtk8\">&#39;&#39;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">                            </span><span class=\"mtk11\">for</span><span class=\"mtk1\">(</span><span class=\"mtk12\">var</span><span class=\"mtk1\"> </span><span class=\"mtk12\">domain</span><span class=\"mtk1\"> </span><span class=\"mtk4\">in</span><span class=\"mtk1\"> </span><span class=\"mtk12\">emailValidator</span><span class=\"mtk1\">){</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">                            </span><span class=\"mtk11\">if</span><span class=\"mtk1\">(</span><span class=\"mtk12\">emailValidator</span><span class=\"mtk1\">[</span><span class=\"mtk12\">domain</span><span class=\"mtk1\">]){</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">                                                        </span><span class=\"mtk15\">if</span><span class=\"mtk1\">(</span><span class=\"mtk12\">domain</span><span class=\"mtk1\"> == </span><span class=\"mtk12\">provider</span><span class=\"mtk1\">){</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">                                                        </span><span class=\"mtk11\">alert</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&quot;Please Provide Business Email Address.&quot;</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">                                                        </span><span class=\"mtk15\">return</span><span class=\"mtk1\"> </span><span class=\"mtk4\">false</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">                                                                        }</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">                                                      }</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">                           }</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\"> </span><span class=\"mtk12\">return</span><span class=\"mtk1\"> </span><span class=\"mtk4\">true</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk4\">}</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk17\">&lt;/</span><span class=\"mtk4\">script</span><span class=\"mtk17\">&gt;</span></span></code></pre>\n<ul>\n<li><strong>Create html form</strong></li>\n</ul>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"js\" data-index=\"3\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk17\">&lt;</span><span class=\"mtk4\">form</span><span class=\"mtk1\"> </span><span class=\"mtk12\">name</span><span class=\"mtk1\">=</span><span class=\"mtk8\">&quot;myForm&quot;</span><span class=\"mtk1\"> </span><span class=\"mtk12\">action</span><span class=\"mtk1\">=</span><span class=\"mtk8\">&quot;emailsubmit.php&quot;</span><span class=\"mtk1\"> </span><span class=\"mtk12\">onsubmit</span><span class=\"mtk1\">=</span><span class=\"mtk8\">&quot;return validateForm(&#39;business_email&#39;);&quot;</span><span class=\"mtk1\"> </span><span class=\"mtk12\">method</span><span class=\"mtk1\">=</span><span class=\"mtk8\">&quot;post&quot;</span><span class=\"mtk17\">&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk17\">&lt;</span><span class=\"mtk4\">input</span><span class=\"mtk1\"> </span><span class=\"mtk12\">type</span><span class=\"mtk1\">=</span><span class=\"mtk8\">&quot;text&quot;</span><span class=\"mtk1\"> </span><span class=\"mtk12\">placeholder</span><span class=\"mtk1\">=</span><span class=\"mtk8\">&quot;Full Name&quot;</span><span class=\"mtk17\">/&gt;&lt;</span><span class=\"mtk4\">br</span><span class=\"mtk17\">&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk17\">&lt;</span><span class=\"mtk4\">input</span><span class=\"mtk1\"> </span><span class=\"mtk12\">type</span><span class=\"mtk1\">=</span><span class=\"mtk8\">&quot;email&quot;</span><span class=\"mtk1\"> </span><span class=\"mtk12\">id</span><span class=\"mtk1\">=</span><span class=\"mtk8\">&quot;business_email&quot;</span><span class=\"mtk1\"> </span><span class=\"mtk12\">name</span><span class=\"mtk1\">=</span><span class=\"mtk8\">&quot;email&quot;</span><span class=\"mtk1\"> </span><span class=\"mtk12\">placeholder</span><span class=\"mtk1\">=</span><span class=\"mtk8\">&quot;Email Address&quot;</span><span class=\"mtk17\">/&gt;&lt;</span><span class=\"mtk4\">br</span><span class=\"mtk17\">&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk17\">&lt;</span><span class=\"mtk4\">input</span><span class=\"mtk1\"> </span><span class=\"mtk12\">type</span><span class=\"mtk1\">=</span><span class=\"mtk8\">&quot;submit&quot;</span><span class=\"mtk1\"> </span><span class=\"mtk12\">value</span><span class=\"mtk1\">=</span><span class=\"mtk8\">&quot;submit&quot;</span><span class=\"mtk17\">/&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\"> </span><span class=\"mtk17\">&lt;/</span><span class=\"mtk4\">form</span><span class=\"mtk17\">&gt;</span></span></code></pre>\n<p>Note: if you have already have html form where you want to apply this avalidator, look up for the buysiness_email and replace it accordingly.</p>\n<ul>\n<li>Save the file and try to execute this html page on a browser.</li>\n</ul>\n<h3 id=\"2-server-side\" style=\"position:relative;\"><a href=\"#2-server-side\" aria-label=\"2 server side permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><strong>2. Server side</strong></h3>\n<p>In Server side validation we use php scripting language to validate entered email at time of submission the html form. So we can flow the following steps to validate it.</p>\n<ul>\n<li>Create a php page with name of emailsubmit.php</li>\n<li>Receive email in php post method by following code.</li>\n</ul>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"php\" data-index=\"4\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\">&lt;?php</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">$email</span><span class=\"mtk1\"> = </span><span class=\"mtk11\">isset</span><span class=\"mtk1\">(</span><span class=\"mtk12\">$_POST</span><span class=\"mtk1\">[‘email’]) ? </span><span class=\"mtk11\">trim</span><span class=\"mtk1\">(</span><span class=\"mtk12\">$_POST</span><span class=\"mtk1\">[‘email’]):’’;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk15\">if</span><span class=\"mtk1\">(!</span><span class=\"mtk11\">empty</span><span class=\"mtk1\">(</span><span class=\"mtk12\">$email</span><span class=\"mtk1\">)){</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">                 </span><span class=\"mtk12\">$tempEmail</span><span class=\"mtk1\"> = </span><span class=\"mtk11\">explode</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&#39;@&#39;</span><span class=\"mtk1\">, </span><span class=\"mtk12\">$email</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">                     </span><span class=\"mtk15\">if</span><span class=\"mtk1\"> (</span><span class=\"mtk11\">isset</span><span class=\"mtk1\">(</span><span class=\"mtk12\">$tempEmail</span><span class=\"mtk1\">[</span><span class=\"mtk8\">&#39;1&#39;</span><span class=\"mtk1\">]) && !</span><span class=\"mtk11\">empty</span><span class=\"mtk1\">(</span><span class=\"mtk12\">$tempEmail</span><span class=\"mtk1\">[</span><span class=\"mtk8\">&#39;1&#39;</span><span class=\"mtk1\">])) {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">                 </span><span class=\"mtk12\">$validEmail</span><span class=\"mtk1\"> = </span><span class=\"mtk11\">json_decode</span><span class=\"mtk1\">(</span><span class=\"mtk11\">file_get_contents</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&#39;freeEmailService.json&#39;</span><span class=\"mtk1\">), </span><span class=\"mtk4\">true</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">                     </span><span class=\"mtk15\">if</span><span class=\"mtk1\"> (</span><span class=\"mtk11\">is_array</span><span class=\"mtk1\">(</span><span class=\"mtk12\">$validEmail</span><span class=\"mtk1\">) && </span><span class=\"mtk11\">in_array</span><span class=\"mtk1\">(</span><span class=\"mtk12\">$tempEmail</span><span class=\"mtk1\">[</span><span class=\"mtk8\">&#39;1&#39;</span><span class=\"mtk1\">], </span><span class=\"mtk11\">array_keys</span><span class=\"mtk1\">(</span><span class=\"mtk12\">$validEmail</span><span class=\"mtk1\">))) {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">                     </span><span class=\"mtk11\">echo</span><span class=\"mtk1\"> </span><span class=\"mtk8\">&quot;Please use business email address.&quot;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">                  }</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">                }</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span><span class=\"mtk15\">else</span><span class=\"mtk1\">{</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">                     </span><span class=\"mtk11\">echo</span><span class=\"mtk1\"> ‘email is required field.’;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">?&gt;</span></span></code></pre>\n<ul>\n<li>Save file and upload on server</li>\n</ul>\n<p>Feel free to add, edit or modify this script as per your requirements. You can contact us if you have any queries.</p>\n<style class=\"grvsc-styles\">\n  .grvsc-container {\n    overflow: auto;\n    -webkit-overflow-scrolling: touch;\n    padding-top: 1rem;\n    padding-top: var(--grvsc-padding-top, var(--grvsc-padding-v, 1rem));\n    padding-bottom: 1rem;\n    padding-bottom: var(--grvsc-padding-bottom, var(--grvsc-padding-v, 1rem));\n    border-radius: 8px;\n    border-radius: var(--grvsc-border-radius, 8px);\n    font-feature-settings: normal;\n  }\n  \n  .grvsc-code {\n    display: inline-block;\n    min-width: 100%;\n  }\n  \n  .grvsc-line {\n    display: inline-block;\n    box-sizing: border-box;\n    width: 100%;\n    padding-left: 1.5rem;\n    padding-left: var(--grvsc-padding-left, var(--grvsc-padding-h, 1.5rem));\n    padding-right: 1.5rem;\n    padding-right: var(--grvsc-padding-right, var(--grvsc-padding-h, 1.5rem));\n  }\n  \n  .grvsc-line-highlighted {\n    background-color: var(--grvsc-line-highlighted-background-color, transparent);\n    box-shadow: inset var(--grvsc-line-highlighted-border-width, 4px) 0 0 0 var(--grvsc-line-highlighted-border-color, transparent);\n  }\n  \n  .dark-default-dark {\n    background-color: #1E1E1E;\n    color: #D4D4D4;\n  }\n  .dark-default-dark .mtk17 { color: #808080; }\n  .dark-default-dark .mtk4 { color: #569CD6; }\n  .dark-default-dark .mtk1 { color: #D4D4D4; }\n  .dark-default-dark .mtk12 { color: #9CDCFE; }\n  .dark-default-dark .mtk8 { color: #CE9178; }\n  .dark-default-dark .mtk11 { color: #DCDCAA; }\n  .dark-default-dark .mtk7 { color: #B5CEA8; }\n  .dark-default-dark .mtk15 { color: #C586C0; }\n</style>","frontmatter":{"title":"Open Source Business Email Validator By Loginradius","author":{"id":"Team LoginRadius","github":"LoginRadius","avatar":null},"date":"April 25, 2017","updated_date":null,"tags":["Engineering"],"coverImage":{"childImageSharp":{"fluid":{"aspectRatio":0.746268656716418,"src":"/static/a657ff09e846d7d100b0fae0ea7714e9/fa668/Open-Source-Business-Validator-By-Loginradius.webp","srcSet":"/static/a657ff09e846d7d100b0fae0ea7714e9/61e93/Open-Source-Business-Validator-By-Loginradius.webp 200w,\n/static/a657ff09e846d7d100b0fae0ea7714e9/fa668/Open-Source-Business-Validator-By-Loginradius.webp 377w","sizes":"(max-width: 377px) 100vw, 377px"}}}},"fields":{"authorId":"Team LoginRadius","slug":"/engineering/open-source-business-email-validator-by-loginradius/"}}},{"node":{"id":"b2c44ee4-a8be-5cea-a539-9c7ae8681c59","html":"<p>POPUPS! They can annoy you but if used properly, they can be a boon to any marketing campaign. In 2015, Taylor wrote an article on best practices to use popup. While the article discussed how to optimize popup, in this article I am going to list down the types of articles and how you can implement them. I have added codes for every type of popup for a better idea.</p>\n<h3 id=\"1-creating-a-basic-popup\" style=\"position:relative;\"><a href=\"#1-creating-a-basic-popup\" aria-label=\"1 creating a basic popup permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><strong>1. Creating a basic popup:</strong></h3>\n<p><img src=\"/bd47340195d928fb4ee883951c59b738/Creating-a-simple-pop-up.webp\" alt=\"Creating a simple pop-up\"></p>\n<p>This section talks about creating a basic popup using simple HTML and CSS. There is a separate section for header, footer and content. I have also added a close button at top right corner of the popup. There are three steps to create this popup.</p>\n<h4 id=\"a-add-html-manage-a-structure-of-a-popup\" style=\"position:relative;\"><a href=\"#a-add-html-manage-a-structure-of-a-popup\" aria-label=\"a add html manage a structure of a popup permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><strong>A. Add HTML [manage a structure of a popup]</strong></h4>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"js\" data-index=\"0\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\">&</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">lt</span><span class=\"mtk1\">;</span><span class=\"mtk12\">div</span><span class=\"mtk1\"> </span><span class=\"mtk12\">class</span><span class=\"mtk1\">=</span><span class=\"mtk8\">&quot;popup-content&quot;</span><span class=\"mtk1\">&</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">gt</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">&</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">lt</span><span class=\"mtk1\">;</span><span class=\"mtk12\">span</span><span class=\"mtk1\"> </span><span class=\"mtk12\">class</span><span class=\"mtk1\">=</span><span class=\"mtk8\">&quot;popup-close&quot;</span><span class=\"mtk1\">&</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">gt</span><span class=\"mtk1\">;&</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">times</span><span class=\"mtk1\">;&</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">lt</span><span class=\"mtk1\">;/</span><span class=\"mtk12\">span</span><span class=\"mtk1\">&</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">gt</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">&</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">lt</span><span class=\"mtk1\">;</span><span class=\"mtk12\">div</span><span class=\"mtk1\"> </span><span class=\"mtk12\">class</span><span class=\"mtk1\">=</span><span class=\"mtk8\">&quot;popup-header&quot;</span><span class=\"mtk1\">&</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">gt</span><span class=\"mtk1\">;</span><span class=\"mtk12\">Header</span><span class=\"mtk1\">&</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">lt</span><span class=\"mtk1\">;/</span><span class=\"mtk12\">div</span><span class=\"mtk1\">&</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">gt</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">&</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">lt</span><span class=\"mtk1\">;</span><span class=\"mtk12\">div</span><span class=\"mtk1\"> </span><span class=\"mtk12\">class</span><span class=\"mtk1\">=</span><span class=\"mtk8\">&quot;popup-body&quot;</span><span class=\"mtk1\">&</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">gt</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">&</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">lt</span><span class=\"mtk1\">;</span><span class=\"mtk12\">p</span><span class=\"mtk1\">&</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">gt</span><span class=\"mtk1\">;</span><span class=\"mtk12\">Your</span><span class=\"mtk1\"> </span><span class=\"mtk12\">popup</span><span class=\"mtk1\"> </span><span class=\"mtk12\">code</span><span class=\"mtk1\"> </span><span class=\"mtk12\">goes</span><span class=\"mtk1\"> </span><span class=\"mtk12\">here</span><span class=\"mtk1\">&</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">lt</span><span class=\"mtk1\">;/</span><span class=\"mtk12\">p</span><span class=\"mtk1\">&</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">gt</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">&</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">lt</span><span class=\"mtk1\">;/</span><span class=\"mtk12\">div</span><span class=\"mtk1\">&</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">gt</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">&</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">lt</span><span class=\"mtk1\">;</span><span class=\"mtk12\">div</span><span class=\"mtk1\"> </span><span class=\"mtk12\">class</span><span class=\"mtk1\">=</span><span class=\"mtk8\">&quot;popup-footer&quot;</span><span class=\"mtk1\">&</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">gt</span><span class=\"mtk1\">;</span><span class=\"mtk12\">Footer</span><span class=\"mtk1\">&</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">lt</span><span class=\"mtk1\">;/</span><span class=\"mtk12\">div</span><span class=\"mtk1\">&</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">gt</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">&</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">lt</span><span class=\"mtk1\">;/</span><span class=\"mtk12\">div</span><span class=\"mtk1\">&</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">gt</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">&</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">lt</span><span class=\"mtk1\">;/</span><span class=\"mtk12\">div</span><span class=\"mtk1\">&</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">gt</span><span class=\"mtk1\">;\\</span></span></code></pre>\n<h4 id=\"b-add-css-display-like-a-popup\" style=\"position:relative;\"><a href=\"#b-add-css-display-like-a-popup\" aria-label=\"b add css display like a popup permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><strong>B. Add CSS [Display Like a popup]</strong></h4>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"css\" data-index=\"1\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\">&amp;amp;lt;style&amp;amp;gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk6\">.popup-layout</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">position</span><span class=\"mtk1\">: </span><span class=\"mtk8\">fixed</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">z-index</span><span class=\"mtk1\">: </span><span class=\"mtk7\">1</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">left</span><span class=\"mtk1\">: </span><span class=\"mtk7\">0</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">top</span><span class=\"mtk1\">: </span><span class=\"mtk7\">0</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">width</span><span class=\"mtk1\">: </span><span class=\"mtk7\">100%</span><span class=\"mtk1\"> ;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">height</span><span class=\"mtk1\">: </span><span class=\"mtk7\">100%</span><span class=\"mtk1\"> ;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">overflow</span><span class=\"mtk1\">: </span><span class=\"mtk8\">auto</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">background-color</span><span class=\"mtk1\">: </span><span class=\"mtk11\">rgb</span><span class=\"mtk1\">(</span><span class=\"mtk7\">0</span><span class=\"mtk1\">, </span><span class=\"mtk7\">0</span><span class=\"mtk1\">, </span><span class=\"mtk7\">0</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">background-color</span><span class=\"mtk1\">: </span><span class=\"mtk11\">rgba</span><span class=\"mtk1\">(</span><span class=\"mtk7\">0</span><span class=\"mtk1\">, </span><span class=\"mtk7\">0</span><span class=\"mtk1\">, </span><span class=\"mtk7\">0</span><span class=\"mtk1\">, </span><span class=\"mtk7\">0.4</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk6\">.popup-header</span><span class=\"mtk1\">,</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk6\">.popup-footer</span><span class=\"mtk1\">{</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">background</span><span class=\"mtk1\">: </span><span class=\"mtk8\">#29f</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">padding</span><span class=\"mtk1\">: </span><span class=\"mtk7\">20px</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">color</span><span class=\"mtk1\">: </span><span class=\"mtk8\">#fff</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">font-weight</span><span class=\"mtk1\">: </span><span class=\"mtk8\">bold</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk6\">.popup-body</span><span class=\"mtk1\">{</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">padding</span><span class=\"mtk1\">: </span><span class=\"mtk7\">20px</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk6\">.popup-content</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">background-color</span><span class=\"mtk1\">: </span><span class=\"mtk8\">#fefefe</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">margin</span><span class=\"mtk1\">: </span><span class=\"mtk7\">15%</span><span class=\"mtk1\"> </span><span class=\"mtk8\">auto</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">border</span><span class=\"mtk1\">: </span><span class=\"mtk7\">1px</span><span class=\"mtk1\"> </span><span class=\"mtk8\">solid</span><span class=\"mtk1\"> </span><span class=\"mtk8\">#888</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">width</span><span class=\"mtk1\">: </span><span class=\"mtk7\">60%</span><span class=\"mtk1\"> ;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk6\">.popup-close</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">color</span><span class=\"mtk1\">: </span><span class=\"mtk8\">#FFF</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">margin</span><span class=\"mtk1\">: </span><span class=\"mtk7\">10px</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">float</span><span class=\"mtk1\">: </span><span class=\"mtk8\">right</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">font-size</span><span class=\"mtk1\">: </span><span class=\"mtk7\">28px</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">font-weight</span><span class=\"mtk1\">: </span><span class=\"mtk8\">bold</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk6\">.popup-close:hover</span><span class=\"mtk1\">,</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk6\">.popup-close:focus</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">color</span><span class=\"mtk1\">: </span><span class=\"mtk8\">black</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">text-decoration</span><span class=\"mtk1\">: </span><span class=\"mtk8\">none</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">cursor</span><span class=\"mtk1\">: </span><span class=\"mtk8\">pointer</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">&amp;amp;lt;/style&amp;amp;gt;</span></span></code></pre>\n<p>Moreover, you can also check out this tutorial of <a href=\"/simple-popup-tutorial/\">creating a basic popup</a> if you want to learn the basic understanding.</p>\n<h4 id=\"c-add-script-for-action-on-close-button\" style=\"position:relative;\"><a href=\"#c-add-script-for-action-on-close-button\" aria-label=\"c add script for action on close button permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><strong>C. Add Script [for action on close button]</strong></h4>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"js\" data-index=\"2\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\">&</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">lt</span><span class=\"mtk1\">;</span><span class=\"mtk12\">script</span><span class=\"mtk1\">&</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">gt</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk4\">var</span><span class=\"mtk1\"> </span><span class=\"mtk12\">popup</span><span class=\"mtk1\">\\_close = </span><span class=\"mtk12\">document</span><span class=\"mtk1\">.</span><span class=\"mtk11\">getElementsByClassName</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&#39;popup-close&#39;</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk15\">for</span><span class=\"mtk1\"> (</span><span class=\"mtk4\">var</span><span class=\"mtk1\"> </span><span class=\"mtk12\">i</span><span class=\"mtk1\"> = </span><span class=\"mtk7\">0</span><span class=\"mtk1\">; </span><span class=\"mtk12\">i</span><span class=\"mtk1\"> &</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">lt</span><span class=\"mtk1\">; </span><span class=\"mtk12\">popup</span><span class=\"mtk1\">\\</span><span class=\"mtk12\">_close</span><span class=\"mtk1\">.</span><span class=\"mtk12\">length</span><span class=\"mtk1\">; </span><span class=\"mtk12\">i</span><span class=\"mtk1\">++) {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk4\">var</span><span class=\"mtk1\"> </span><span class=\"mtk12\">closeThis</span><span class=\"mtk1\"> = </span><span class=\"mtk12\">popup</span><span class=\"mtk1\">\\</span><span class=\"mtk12\">_close</span><span class=\"mtk1\">\\[</span><span class=\"mtk12\">i</span><span class=\"mtk1\">\\];</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">closeThis</span><span class=\"mtk1\">.</span><span class=\"mtk11\">addEventListener</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&quot;click&quot;</span><span class=\"mtk1\">, </span><span class=\"mtk4\">function</span><span class=\"mtk1\"> () {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">document</span><span class=\"mtk1\">.</span><span class=\"mtk11\">getElementsByClassName</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&#39;popup-layout&#39;</span><span class=\"mtk1\">)\\[</span><span class=\"mtk7\">0</span><span class=\"mtk1\">\\].</span><span class=\"mtk12\">style</span><span class=\"mtk1\">.</span><span class=\"mtk12\">display</span><span class=\"mtk1\"> = </span><span class=\"mtk8\">&quot;none&quot;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}, </span><span class=\"mtk4\">false</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">&</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">lt</span><span class=\"mtk1\">;/</span><span class=\"mtk12\">script</span><span class=\"mtk1\">&</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">gt</span><span class=\"mtk1\">;</span></span></code></pre>\n<h3 id=\"2-creating-a-timer-based-popup\" style=\"position:relative;\"><a href=\"#2-creating-a-timer-based-popup\" aria-label=\"2 creating a timer based popup permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><strong>2. Creating a timer based popup:</strong></h3>\n<p><img src=\"/4a93f6818c189a0fb1ca01cb37f962ff/Creating-a-timer-based-popup.gif\" alt=\"Creating a timer based popup\"></p>\n<p>This is a timer based popup which can be displayed at a certain time after the page is loaded.</p>\n<p>For reference, I have added the code to display the popup after 5 second [Add following code]. Steps are as below.</p>\n<p>Follow all the steps mentioned in section 1. (Creating a simple popup) and add the following code below that code.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"js\" data-index=\"3\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\">&</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">lt</span><span class=\"mtk1\">;</span><span class=\"mtk12\">script</span><span class=\"mtk1\">&</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">gt</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">document</span><span class=\"mtk1\">.</span><span class=\"mtk11\">getElementsByClassName</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&#39;popup-layout&#39;</span><span class=\"mtk1\">)\\[</span><span class=\"mtk7\">0</span><span class=\"mtk1\">\\].</span><span class=\"mtk12\">style</span><span class=\"mtk1\">.</span><span class=\"mtk12\">display</span><span class=\"mtk1\"> = </span><span class=\"mtk8\">&quot;none&quot;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk11\">setTimeout</span><span class=\"mtk1\">(</span><span class=\"mtk4\">function</span><span class=\"mtk1\"> () {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">document</span><span class=\"mtk1\">.</span><span class=\"mtk11\">getElementsByClassName</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&#39;popup-layout&#39;</span><span class=\"mtk1\">)\\[</span><span class=\"mtk7\">0</span><span class=\"mtk1\">\\].</span><span class=\"mtk12\">style</span><span class=\"mtk1\">.</span><span class=\"mtk12\">display</span><span class=\"mtk1\"> = </span><span class=\"mtk8\">&quot;block&quot;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}, </span><span class=\"mtk7\">5000</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">&</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">lt</span><span class=\"mtk1\">;/</span><span class=\"mtk12\">script</span><span class=\"mtk1\">&</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">gt</span><span class=\"mtk1\">;</span></span></code></pre>\n<p>To Auto hide after 5 second, add following code.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"js\" data-index=\"4\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\">&</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">lt</span><span class=\"mtk1\">;</span><span class=\"mtk12\">script</span><span class=\"mtk1\">&</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">gt</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">document</span><span class=\"mtk1\">.</span><span class=\"mtk11\">getElementsByClassName</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&#39;popup-layout&#39;</span><span class=\"mtk1\">)\\[</span><span class=\"mtk7\">0</span><span class=\"mtk1\">\\].</span><span class=\"mtk12\">style</span><span class=\"mtk1\">.</span><span class=\"mtk12\">display</span><span class=\"mtk1\"> = </span><span class=\"mtk8\">&quot;block&quot;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk11\">setTimeout</span><span class=\"mtk1\">(</span><span class=\"mtk4\">function</span><span class=\"mtk1\"> () {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">document</span><span class=\"mtk1\">.</span><span class=\"mtk11\">getElementsByClassName</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&#39;popup-layout&#39;</span><span class=\"mtk1\">)\\[</span><span class=\"mtk7\">0</span><span class=\"mtk1\">\\].</span><span class=\"mtk12\">style</span><span class=\"mtk1\">.</span><span class=\"mtk12\">display</span><span class=\"mtk1\"> = </span><span class=\"mtk8\">&quot;none&quot;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}, </span><span class=\"mtk7\">5000</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">&</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">lt</span><span class=\"mtk1\">;/</span><span class=\"mtk12\">script</span><span class=\"mtk1\">&</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">gt</span><span class=\"mtk1\">;</span></span></code></pre>\n<h3 id=\"3-creating-a-scroll-popup\" style=\"position:relative;\"><a href=\"#3-creating-a-scroll-popup\" aria-label=\"3 creating a scroll popup permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><strong>3. Creating a Scroll popup:</strong></h3>\n<p>This one shows up when you scroll down the page. I have set it to 500 pixels, you can change as per requirements</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"js\" data-index=\"5\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\">&</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">lt</span><span class=\"mtk1\">;</span><span class=\"mtk12\">script</span><span class=\"mtk1\">&</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">gt</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">document</span><span class=\"mtk1\">.</span><span class=\"mtk11\">getElementsByClassName</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&#39;popup-layout&#39;</span><span class=\"mtk1\">)\\[</span><span class=\"mtk7\">0</span><span class=\"mtk1\">\\].</span><span class=\"mtk12\">style</span><span class=\"mtk1\">.</span><span class=\"mtk12\">display</span><span class=\"mtk1\"> = </span><span class=\"mtk8\">&quot;none&quot;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">window</span><span class=\"mtk1\">.</span><span class=\"mtk11\">onscroll</span><span class=\"mtk1\"> = </span><span class=\"mtk4\">function</span><span class=\"mtk1\"> () {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk15\">if</span><span class=\"mtk1\"> (</span><span class=\"mtk12\">document</span><span class=\"mtk1\">.</span><span class=\"mtk12\">body</span><span class=\"mtk1\">.</span><span class=\"mtk12\">scrollTop</span><span class=\"mtk1\"> &</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">gt</span><span class=\"mtk1\">; </span><span class=\"mtk7\">500</span><span class=\"mtk1\"> || </span><span class=\"mtk12\">document</span><span class=\"mtk1\">.</span><span class=\"mtk12\">documentElement</span><span class=\"mtk1\">.</span><span class=\"mtk12\">scrollTop</span><span class=\"mtk1\"> &</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">gt</span><span class=\"mtk1\">; </span><span class=\"mtk7\">500</span><span class=\"mtk1\">) {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">document</span><span class=\"mtk1\">.</span><span class=\"mtk11\">getElementsByClassName</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&#39;popup-layout&#39;</span><span class=\"mtk1\">)\\[</span><span class=\"mtk7\">0</span><span class=\"mtk1\">\\].</span><span class=\"mtk12\">style</span><span class=\"mtk1\">.</span><span class=\"mtk12\">display</span><span class=\"mtk1\"> = </span><span class=\"mtk8\">&quot;block&quot;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">&</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">lt</span><span class=\"mtk1\">;/</span><span class=\"mtk12\">script</span><span class=\"mtk1\">&</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">gt</span><span class=\"mtk1\">;</span></span></code></pre>\n<h3 id=\"4-creating-a-scroll--time-5-second-popup\" style=\"position:relative;\"><a href=\"#4-creating-a-scroll--time-5-second-popup\" aria-label=\"4 creating a scroll  time 5 second popup permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><strong>4. Creating a Scroll / Time [5 second] popup:</strong></h3>\n<p>Pretty much the same as above but this one shows popup after 5 seconds of scrolling .</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"js\" data-index=\"6\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\">&</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">lt</span><span class=\"mtk1\">;</span><span class=\"mtk12\">script</span><span class=\"mtk1\">&</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">gt</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">document</span><span class=\"mtk1\">.</span><span class=\"mtk11\">getElementsByClassName</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&#39;popup-layout&#39;</span><span class=\"mtk1\">)\\[</span><span class=\"mtk7\">0</span><span class=\"mtk1\">\\].</span><span class=\"mtk12\">style</span><span class=\"mtk1\">.</span><span class=\"mtk12\">display</span><span class=\"mtk1\"> = </span><span class=\"mtk8\">&quot;none&quot;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">window</span><span class=\"mtk1\">.</span><span class=\"mtk11\">onscroll</span><span class=\"mtk1\"> = </span><span class=\"mtk4\">function</span><span class=\"mtk1\"> () {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk15\">if</span><span class=\"mtk1\"> (</span><span class=\"mtk12\">document</span><span class=\"mtk1\">.</span><span class=\"mtk12\">body</span><span class=\"mtk1\">.</span><span class=\"mtk12\">scrollTop</span><span class=\"mtk1\"> &</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">gt</span><span class=\"mtk1\">; </span><span class=\"mtk7\">500</span><span class=\"mtk1\"> || </span><span class=\"mtk12\">document</span><span class=\"mtk1\">.</span><span class=\"mtk12\">documentElement</span><span class=\"mtk1\">.</span><span class=\"mtk12\">scrollTop</span><span class=\"mtk1\"> &</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">gt</span><span class=\"mtk1\">; </span><span class=\"mtk7\">500</span><span class=\"mtk1\">) {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk11\">setTimeout</span><span class=\"mtk1\">(</span><span class=\"mtk4\">function</span><span class=\"mtk1\"> () {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">document</span><span class=\"mtk1\">.</span><span class=\"mtk11\">getElementsByClassName</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&#39;popup-layout&#39;</span><span class=\"mtk1\">)\\[</span><span class=\"mtk7\">0</span><span class=\"mtk1\">\\].</span><span class=\"mtk12\">style</span><span class=\"mtk1\">.</span><span class=\"mtk12\">display</span><span class=\"mtk1\"> = </span><span class=\"mtk8\">&quot;block&quot;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">},</span><span class=\"mtk7\">5000</span><span class=\"mtk1\"> }</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">&</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">lt</span><span class=\"mtk1\">;/</span><span class=\"mtk12\">script</span><span class=\"mtk1\">&</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">gt</span><span class=\"mtk1\">;</span></span></code></pre>\n<h3 id=\"5-creating-an-exit-popup\" style=\"position:relative;\"><a href=\"#5-creating-an-exit-popup\" aria-label=\"5 creating an exit popup permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><strong>5. Creating an Exit popup:</strong></h3>\n<p><img src=\"/c718dfa91184e4494f4d856fd051d640/Creating-an-exit-popup.gif\" alt=\"Creating an exit popup\"></p>\n<p>Only confirmation alert popup will show and you can’t make changes in html of this popup. Use following line of code on a single page.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"js\" data-index=\"7\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\">&</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">lt</span><span class=\"mtk1\">;</span><span class=\"mtk12\">script</span><span class=\"mtk1\">&</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">gt</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">window</span><span class=\"mtk1\">.</span><span class=\"mtk11\">onbeforeunload</span><span class=\"mtk1\"> = </span><span class=\"mtk4\">function</span><span class=\"mtk1\">() {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk15\">return</span><span class=\"mtk1\"> </span><span class=\"mtk8\">&quot;You are about to leave&quot;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">&</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">lt</span><span class=\"mtk1\">;/</span><span class=\"mtk12\">script</span><span class=\"mtk1\">&</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">gt</span><span class=\"mtk1\">;</span></span></code></pre>\n<p>There is another variation you can make here. In this scenario, if the user moves his cursor beyond the browser screen, you can create a popup to convince the user to stay. Below is the line of code you will need.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"js\" data-index=\"8\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\">&</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">lt</span><span class=\"mtk1\">;</span><span class=\"mtk12\">script</span><span class=\"mtk1\">&</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">gt</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">document</span><span class=\"mtk1\">.</span><span class=\"mtk11\">getElementsByClassName</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&#39;popup-layout&#39;</span><span class=\"mtk1\">)\\[</span><span class=\"mtk7\">0</span><span class=\"mtk1\">\\].</span><span class=\"mtk12\">style</span><span class=\"mtk1\">.</span><span class=\"mtk12\">display</span><span class=\"mtk1\"> = </span><span class=\"mtk8\">&quot;none&quot;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">document</span><span class=\"mtk1\">.</span><span class=\"mtk11\">addEventListener</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&quot;mouseout&quot;</span><span class=\"mtk1\">, </span><span class=\"mtk4\">function</span><span class=\"mtk1\"> (</span><span class=\"mtk12\">event</span><span class=\"mtk1\">) {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">document</span><span class=\"mtk1\">.</span><span class=\"mtk11\">getElementsByClassName</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&#39;popup-layout&#39;</span><span class=\"mtk1\">)\\[</span><span class=\"mtk7\">0</span><span class=\"mtk1\">\\].</span><span class=\"mtk12\">style</span><span class=\"mtk1\">.</span><span class=\"mtk12\">display</span><span class=\"mtk1\"> = </span><span class=\"mtk8\">&quot;block&quot;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">});</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">&</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">lt</span><span class=\"mtk1\">;/</span><span class=\"mtk12\">script</span><span class=\"mtk1\">&</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">amp</span><span class=\"mtk1\">;</span><span class=\"mtk12\">gt</span><span class=\"mtk1\">;</span></span></code></pre>\n<p>So guys, I hope this guide helped you through various types of popups. If you love animating your pop-up, you might want to check out this tutorial of <a href=\"/animating-simple-css-popup-tutorial/\">creating an animated CSS pop-up</a>. Do try them and let us know your experiences.</p>\n<style class=\"grvsc-styles\">\n  .grvsc-container {\n    overflow: auto;\n    -webkit-overflow-scrolling: touch;\n    padding-top: 1rem;\n    padding-top: var(--grvsc-padding-top, var(--grvsc-padding-v, 1rem));\n    padding-bottom: 1rem;\n    padding-bottom: var(--grvsc-padding-bottom, var(--grvsc-padding-v, 1rem));\n    border-radius: 8px;\n    border-radius: var(--grvsc-border-radius, 8px);\n    font-feature-settings: normal;\n  }\n  \n  .grvsc-code {\n    display: inline-block;\n    min-width: 100%;\n  }\n  \n  .grvsc-line {\n    display: inline-block;\n    box-sizing: border-box;\n    width: 100%;\n    padding-left: 1.5rem;\n    padding-left: var(--grvsc-padding-left, var(--grvsc-padding-h, 1.5rem));\n    padding-right: 1.5rem;\n    padding-right: var(--grvsc-padding-right, var(--grvsc-padding-h, 1.5rem));\n  }\n  \n  .grvsc-line-highlighted {\n    background-color: var(--grvsc-line-highlighted-background-color, transparent);\n    box-shadow: inset var(--grvsc-line-highlighted-border-width, 4px) 0 0 0 var(--grvsc-line-highlighted-border-color, transparent);\n  }\n  \n  .dark-default-dark {\n    background-color: #1E1E1E;\n    color: #D4D4D4;\n  }\n  .dark-default-dark .mtk1 { color: #D4D4D4; }\n  .dark-default-dark .mtk12 { color: #9CDCFE; }\n  .dark-default-dark .mtk8 { color: #CE9178; }\n  .dark-default-dark .mtk6 { color: #D7BA7D; }\n  .dark-default-dark .mtk7 { color: #B5CEA8; }\n  .dark-default-dark .mtk11 { color: #DCDCAA; }\n  .dark-default-dark .mtk4 { color: #569CD6; }\n  .dark-default-dark .mtk15 { color: #C586C0; }\n</style>","frontmatter":{"title":"Know The Types of Website Popups and How to Create Them","author":{"id":"Team LoginRadius","github":"LoginRadius","avatar":null},"date":"April 20, 2017","updated_date":null,"tags":["CSS"],"coverImage":{"childImageSharp":{"fluid":{"aspectRatio":1.7699115044247788,"src":"/static/d404c01e7d4da26cf8ec6404c910921c/5239a/The-Ultimate-guide-to-website-pop-ups.webp","srcSet":"/static/d404c01e7d4da26cf8ec6404c910921c/61e93/The-Ultimate-guide-to-website-pop-ups.webp 200w,\n/static/d404c01e7d4da26cf8ec6404c910921c/1f5c5/The-Ultimate-guide-to-website-pop-ups.webp 400w,\n/static/d404c01e7d4da26cf8ec6404c910921c/5239a/The-Ultimate-guide-to-website-pop-ups.webp 560w","sizes":"(max-width: 560px) 100vw, 560px"}}}},"fields":{"authorId":"Team LoginRadius","slug":"/engineering/the-ultimate-guide-to-website-pop-ups/"}}},{"node":{"id":"7dc6396b-28be-53c9-857e-9745d611ecdd","html":"<p>JavaScript or JS helps implement complex things on web pages. Many of the developers know the importance of an minified Javascript file but few are aware of an Optimized Javascript code.</p>\n<p>An optimized code is a combination of smartly programmed logics and small hacks to optimize performance, speed and save time.</p>\n<p>Here are sweet 16 <strong>JS hacks and tips</strong> for developers  for optimizing Javascript to improve JS performance and improve execution time without affecting server resources.</p>\n<h3 id=\"1-use-array-filter\" style=\"position:relative;\"><a href=\"#1-use-array-filter\" aria-label=\"1 use array filter permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><strong>1. Use Array Filter</strong></h3>\n<p>It is a small hack to filter out bucket of elements from the array pool. This method creates an array filled with all array elements that pass a test (provided as a function). According to requirement create a callback function for non-required elements.</p>\n<p>In below example the bucket elements are <em>null</em> and are ready to get filtered out. </p>\n<p>Example:</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"js\" data-index=\"0\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk12\">schema</span><span class=\"mtk1\"> = [</span><span class=\"mtk8\">&quot;hi&quot;</span><span class=\"mtk1\">,</span><span class=\"mtk8\">&quot;ihaveboyfriend&quot;</span><span class=\"mtk1\">,</span><span class=\"mtk4\">null</span><span class=\"mtk1\">, </span><span class=\"mtk4\">null</span><span class=\"mtk1\">, </span><span class=\"mtk8\">&quot;goodbye&quot;</span><span class=\"mtk1\">]</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">schema</span><span class=\"mtk1\"> = </span><span class=\"mtk12\">schema</span><span class=\"mtk1\">.</span><span class=\"mtk11\">filter</span><span class=\"mtk1\">(</span><span class=\"mtk4\">function</span><span class=\"mtk1\">(</span><span class=\"mtk12\">n</span><span class=\"mtk1\">) {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\"> </span><span class=\"mtk15\">return</span><span class=\"mtk1\"> </span><span class=\"mtk12\">n</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\"> });</span></span></code></pre>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"\" data-index=\"1\"><code class=\"grvsc-code\"><span class=\"grvsc-line\">Output: [&quot;hi&quot;,&quot;ihaveboyfriend&quot;, &quot;goodbye&quot;]</span></code></pre>\n<p>This hack will save some time and lines of codes for developers.</p>\n<h3 id=\"2-using-string-replace-function-to-replace-all-the-values\" style=\"position:relative;\"><a href=\"#2-using-string-replace-function-to-replace-all-the-values\" aria-label=\"2 using string replace function to replace all the values permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><strong>2. Using String replace function to replace all the values</strong></h3>\n<p><em>The String.replace()</em> <em>function</em> allows you to replace strings using String and Regex.</p>\n<p>Basically this function replaces the string at its first occurrence. But to replace all using <em>replaceAll()</em> function, use <em>/g</em> at the end of a Regex:</p>\n<p>Example:</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"js\" data-index=\"2\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk4\">var</span><span class=\"mtk1\"> </span><span class=\"mtk12\">string</span><span class=\"mtk1\"> = </span><span class=\"mtk8\">&quot;login login&quot;</span><span class=\"mtk1\">; </span></span>\n<span class=\"grvsc-line\"><span class=\"mtk10\">console</span><span class=\"mtk1\">.</span><span class=\"mtk11\">log</span><span class=\"mtk1\">(</span><span class=\"mtk12\">string</span><span class=\"mtk1\">.</span><span class=\"mtk11\">replace</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&quot;in&quot;</span><span class=\"mtk1\">, </span><span class=\"mtk8\">&quot;out&quot;</span><span class=\"mtk1\">)); </span><span class=\"mtk3\">// &quot;logout login&quot; </span></span>\n<span class=\"grvsc-line\"><span class=\"mtk10\">console</span><span class=\"mtk1\">.</span><span class=\"mtk11\">log</span><span class=\"mtk1\">(</span><span class=\"mtk12\">string</span><span class=\"mtk1\">.</span><span class=\"mtk11\">replace</span><span class=\"mtk1\">(</span><span class=\"mtk5\">/in/</span><span class=\"mtk4\">g</span><span class=\"mtk1\">, </span><span class=\"mtk8\">&quot;out&quot;</span><span class=\"mtk1\">)); </span><span class=\"mtk3\">//&quot;logout logout&quot;</span></span></code></pre>\n<h3 id=\"3use-breakpoints-and-console-for-debugging\" style=\"position:relative;\"><a href=\"#3use-breakpoints-and-console-for-debugging\" aria-label=\"3use breakpoints and console for debugging permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><strong>3. Use breakpoints and Console for Debugging</strong></h3>\n<p>With the help of <strong>breakpoints</strong> or <strong>debugging points</strong> you can set multiple barriers to rectify source of error at every barrier. </p>\n<p><img src=\"/992c71b11d837822cbd06b34a3aa6a64/Use-breakpoints-and-Console-for-Debugging-1.webp\" alt=\"Use breakpoints and Console for Debugging\"></p>\n<p>Press F11 for next call function and f8 to resume script execution.</p>\n<p><img src=\"/b8654e35d670696359fad0c72a2cc5e2/Use-breakpoints-and-Console-for-Debugging-2.webp\" alt=\"Use breakpoints and Console for Debugging\"></p>\n<p>You can also check what dynamic values are generated by a function, using console and can check output on different values.</p>\n<h3 id=\"4-convert-to-floating-number-without-killing-performance\" style=\"position:relative;\"><a href=\"#4-convert-to-floating-number-without-killing-performance\" aria-label=\"4 convert to floating number without killing performance permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><strong>4. Convert to floating number without killing performance</strong></h3>\n<p>Often we use <strong>math.floor</strong>, <strong>math.ceil</strong> and <strong>math.round</strong> for eliminating decimals. Instead of using them <strong>use “~~”</strong> to eliminate decimals for a value.</p>\n<p>It is also helpful in increasing performance when it comes to micro optimizations in a code.</p>\n<p><strong>Example:</strong></p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"js\" data-index=\"3\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk12\">Use</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">~~ (</span><span class=\"mtk12\">math</span><span class=\"mtk1\">.</span><span class=\"mtk12\">random</span><span class=\"mtk1\">*</span><span class=\"mtk7\">100</span><span class=\"mtk1\">)</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">Instead</span><span class=\"mtk1\"> </span><span class=\"mtk4\">of</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">math</span><span class=\"mtk1\">.</span><span class=\"mtk11\">round</span><span class=\"mtk1\">(</span><span class=\"mtk12\">math</span><span class=\"mtk1\">.</span><span class=\"mtk12\">random</span><span class=\"mtk1\">*</span><span class=\"mtk7\">100</span><span class=\"mtk1\">)</span></span></code></pre>\n<h3 id=\"5-using-length-to-delete-empty-in-an-array\" style=\"position:relative;\"><a href=\"#5-using-length-to-delete-empty-in-an-array\" aria-label=\"5 using length to delete empty in an array permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><strong>5. Using length to delete empty in an array</strong></h3>\n<p>This technique will help you in resizing and emptying an array.</p>\n<p>For deleting n elements in an Array, use <em><strong>array.length</strong></em>. </p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"js\" data-index=\"4\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\"> </span><span class=\"mtk12\">array</span><span class=\"mtk1\">.</span><span class=\"mtk12\">length</span><span class=\"mtk1\"> = </span><span class=\"mtk12\">n</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">See</span><span class=\"mtk1\"> </span><span class=\"mtk4\">this</span><span class=\"mtk1\"> example:</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk4\">var</span><span class=\"mtk1\"> </span><span class=\"mtk12\">array</span><span class=\"mtk1\"> = [</span><span class=\"mtk7\">1</span><span class=\"mtk1\">, </span><span class=\"mtk7\">2</span><span class=\"mtk1\">, </span><span class=\"mtk7\">3</span><span class=\"mtk1\">, </span><span class=\"mtk7\">4</span><span class=\"mtk1\">, </span><span class=\"mtk7\">5</span><span class=\"mtk1\">, </span><span class=\"mtk7\">6</span><span class=\"mtk1\">]; </span></span>\n<span class=\"grvsc-line\"><span class=\"mtk10\">console</span><span class=\"mtk1\">.</span><span class=\"mtk11\">log</span><span class=\"mtk1\">(</span><span class=\"mtk12\">array</span><span class=\"mtk1\">.</span><span class=\"mtk12\">length</span><span class=\"mtk1\">); </span><span class=\"mtk3\">// 6 </span></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">array</span><span class=\"mtk1\">.</span><span class=\"mtk12\">length</span><span class=\"mtk1\"> = </span><span class=\"mtk7\">3</span><span class=\"mtk1\">; </span></span>\n<span class=\"grvsc-line\"><span class=\"mtk10\">console</span><span class=\"mtk1\">.</span><span class=\"mtk11\">log</span><span class=\"mtk1\">(</span><span class=\"mtk12\">array</span><span class=\"mtk1\">.</span><span class=\"mtk12\">length</span><span class=\"mtk1\">); </span><span class=\"mtk3\">// 3 </span></span>\n<span class=\"grvsc-line\"><span class=\"mtk10\">console</span><span class=\"mtk1\">.</span><span class=\"mtk11\">log</span><span class=\"mtk1\">(</span><span class=\"mtk12\">array</span><span class=\"mtk1\">); </span><span class=\"mtk3\">// [1,2,3]</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">For</span><span class=\"mtk1\"> **</span><span class=\"mtk12\">emptying</span><span class=\"mtk1\"> </span><span class=\"mtk12\">array</span><span class=\"mtk1\">** </span><span class=\"mtk12\">use</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">array</span><span class=\"mtk1\">.</span><span class=\"mtk12\">length</span><span class=\"mtk1\"> = </span><span class=\"mtk7\">0</span><span class=\"mtk1\">;.</span></span></code></pre>\n<p><strong>Example:</strong></p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"js\" data-index=\"5\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk4\">var</span><span class=\"mtk1\"> </span><span class=\"mtk12\">array</span><span class=\"mtk1\"> = [</span><span class=\"mtk7\">1</span><span class=\"mtk1\">, </span><span class=\"mtk7\">2</span><span class=\"mtk1\">, </span><span class=\"mtk7\">3</span><span class=\"mtk1\">, </span><span class=\"mtk7\">4</span><span class=\"mtk1\">, </span><span class=\"mtk7\">5</span><span class=\"mtk1\">, </span><span class=\"mtk7\">6</span><span class=\"mtk1\">]; </span></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">array</span><span class=\"mtk1\">.</span><span class=\"mtk12\">length</span><span class=\"mtk1\"> = </span><span class=\"mtk7\">0</span><span class=\"mtk1\">; </span></span>\n<span class=\"grvsc-line\"><span class=\"mtk10\">console</span><span class=\"mtk1\">.</span><span class=\"mtk11\">log</span><span class=\"mtk1\">(</span><span class=\"mtk12\">array</span><span class=\"mtk1\">.</span><span class=\"mtk12\">length</span><span class=\"mtk1\">); </span><span class=\"mtk3\">// 0 </span></span>\n<span class=\"grvsc-line\"><span class=\"mtk10\">console</span><span class=\"mtk1\">.</span><span class=\"mtk11\">log</span><span class=\"mtk1\">(</span><span class=\"mtk12\">array</span><span class=\"mtk1\">); </span><span class=\"mtk3\">// []</span></span></code></pre>\n<p>This technique is <strong>mostly preferred</strong> over any other methods to resize/unset the array elements and is one of the <strong>best javascript practices</strong> most of the developers follow.</p>\n<h3 id=\"6-merging-arrays-without-causing-server-load\" style=\"position:relative;\"><a href=\"#6-merging-arrays-without-causing-server-load\" aria-label=\"6 merging arrays without causing server load permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><strong>6. Merging arrays without causing server load</strong></h3>\n<p>If your requirement is of <strong>merging two arrays</strong>, use Array.concat() function</p>\n<p>For merging two arrays:</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"js\" data-index=\"6\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk4\">var</span><span class=\"mtk1\"> </span><span class=\"mtk12\">array1</span><span class=\"mtk1\"> = [</span><span class=\"mtk7\">1</span><span class=\"mtk1\">, </span><span class=\"mtk7\">2</span><span class=\"mtk1\">, </span><span class=\"mtk7\">3</span><span class=\"mtk1\">]; </span></span>\n<span class=\"grvsc-line\"><span class=\"mtk4\">var</span><span class=\"mtk1\"> </span><span class=\"mtk12\">array2</span><span class=\"mtk1\"> = [</span><span class=\"mtk7\">4</span><span class=\"mtk1\">, </span><span class=\"mtk7\">5</span><span class=\"mtk1\">, </span><span class=\"mtk7\">6</span><span class=\"mtk1\">]; </span></span>\n<span class=\"grvsc-line\"><span class=\"mtk10\">console</span><span class=\"mtk1\">.</span><span class=\"mtk11\">log</span><span class=\"mtk1\">(</span><span class=\"mtk12\">array1</span><span class=\"mtk1\">.</span><span class=\"mtk11\">concat</span><span class=\"mtk1\">(</span><span class=\"mtk12\">array2</span><span class=\"mtk1\">)); </span><span class=\"mtk3\">// [1,2,3,4,5,6]; </span></span></code></pre>\n<p>This function works best for small arrays.</p>\n<p>To <strong>merge large arrays</strong> we use</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"js\" data-index=\"7\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk10\">Array</span><span class=\"mtk1\">.</span><span class=\"mtk12\">push</span><span class=\"mtk1\">.</span><span class=\"mtk11\">apply</span><span class=\"mtk1\">(</span><span class=\"mtk12\">arr1</span><span class=\"mtk1\">, </span><span class=\"mtk12\">arr2</span><span class=\"mtk1\">)</span></span></code></pre>\n<p>Reason is using Array.concat() function on large arrays will <strong>consume lot of memory</strong> while creating a separate new array.</p>\n<p>In this case, you can use Array.push.apply(arr1, arr2) which instead will merge the second array in the first one, hence <strong>reducing the memory usage</strong>.</p>\n<p><strong>Example:</strong></p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"js\" data-index=\"8\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk4\">var</span><span class=\"mtk1\"> </span><span class=\"mtk12\">array1</span><span class=\"mtk1\"> = [</span><span class=\"mtk7\">1</span><span class=\"mtk1\">, </span><span class=\"mtk7\">2</span><span class=\"mtk1\">, </span><span class=\"mtk7\">3</span><span class=\"mtk1\">]; </span></span>\n<span class=\"grvsc-line\"><span class=\"mtk4\">var</span><span class=\"mtk1\"> </span><span class=\"mtk12\">array2</span><span class=\"mtk1\"> = [</span><span class=\"mtk7\">4</span><span class=\"mtk1\">, </span><span class=\"mtk7\">5</span><span class=\"mtk1\">, </span><span class=\"mtk7\">6</span><span class=\"mtk1\">]; </span></span>\n<span class=\"grvsc-line\"><span class=\"mtk10\">console</span><span class=\"mtk1\">.</span><span class=\"mtk11\">log</span><span class=\"mtk1\">(</span><span class=\"mtk12\">array1</span><span class=\"mtk1\">.</span><span class=\"mtk12\">push</span><span class=\"mtk1\">.</span><span class=\"mtk11\">apply</span><span class=\"mtk1\">(</span><span class=\"mtk12\">array1</span><span class=\"mtk1\">, </span><span class=\"mtk12\">array2</span><span class=\"mtk1\">)); </span><span class=\"mtk3\">// [1,2,3,4,5,6];</span></span></code></pre>\n<p>It will also optimize the performance of your Javascript code irrespective of size of array.</p>\n<h3 id=\"7-use-splice-to-delete-array-elements\" style=\"position:relative;\"><a href=\"#7-use-splice-to-delete-array-elements\" aria-label=\"7 use splice to delete array elements permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><strong>7. Use splice  to delete array elements</strong></h3>\n<p>This is probably the one of the best <strong>optimization tips for javascript</strong>. It <strong>optimizes speed</strong> of your JS code.</p>\n<p>Using splice instead of delete is a good practice, it will save some”null/undefined space” in your code.</p>\n<p>The downside of <strong>using delete</strong> is it will delete the object property, but will <strong>not reindex the array</strong> or update its length, leaving undefined values. Also it consumes a-lot of time in execution.</p>\n<p>Using <em>splice</em></p>\n<p>Example</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"js\" data-index=\"9\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk12\">myArray</span><span class=\"mtk1\"> = [</span><span class=\"mtk8\">&quot;a&quot;</span><span class=\"mtk1\">, </span><span class=\"mtk8\">&quot;b&quot;</span><span class=\"mtk1\">, </span><span class=\"mtk8\">&quot;c&quot;</span><span class=\"mtk1\">, </span><span class=\"mtk8\">&quot;d&quot;</span><span class=\"mtk1\">] </span></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">myArray</span><span class=\"mtk1\">.</span><span class=\"mtk11\">splice</span><span class=\"mtk1\">(</span><span class=\"mtk7\">0</span><span class=\"mtk1\">, </span><span class=\"mtk7\">2</span><span class=\"mtk1\">) [</span><span class=\"mtk8\">&quot;a&quot;</span><span class=\"mtk1\">, </span><span class=\"mtk8\">&quot;b&quot;</span><span class=\"mtk1\">]</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">Result: </span><span class=\"mtk12\">myArray</span><span class=\"mtk1\"> [</span><span class=\"mtk8\">&quot;c&quot;</span><span class=\"mtk1\">, </span><span class=\"mtk8\">&quot;d&quot;</span><span class=\"mtk1\">]</span></span></code></pre>\n<h3 id=\"8-checking-values-in-an-object\" style=\"position:relative;\"><a href=\"#8-checking-values-in-an-object\" aria-label=\"8 checking values in an object permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><strong>8. Checking values in an Object</strong></h3>\n<p>To check whether an object is empty or not,  use</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"js\" data-index=\"10\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk10\">Object</span><span class=\"mtk1\">.</span><span class=\"mtk11\">keys</span><span class=\"mtk1\">(</span><span class=\"mtk12\">YOUR</span><span class=\"mtk1\">\\</span><span class=\"mtk12\">_OBJECT</span><span class=\"mtk1\">).</span><span class=\"mtk12\">length</span><span class=\"mtk1\"> </span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk3\">// 0 returns if object is empty</span></span></code></pre>\n<p>Following code return the number of elements in an Object.</p>\n<h3 id=\"9-cache-the-variable\" style=\"position:relative;\"><a href=\"#9-cache-the-variable\" aria-label=\"9 cache the variable permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><strong>9. Cache the variable</strong></h3>\n<p>Caching the variable tremendously <strong>increase javascript performance</strong>.</p>\n<p>Everytime we use document.getElementById() or getElementsByClassName(), JS travels through all elements repeatedly upon each similar element request.</p>\n<p>In Order to boost performance, <strong>cache your selections</strong> to some variable (if using the same selection multiple times).</p>\n<p><strong>Example:</strong></p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"js\" data-index=\"11\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk4\">var</span><span class=\"mtk1\"> </span><span class=\"mtk12\">cached</span><span class=\"mtk1\"> = </span><span class=\"mtk12\">document</span><span class=\"mtk1\">.</span><span class=\"mtk11\">getElementById</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&#39;someElement&#39;</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">cached</span><span class=\"mtk1\">.</span><span class=\"mtk11\">addClass</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&#39;cached-element&#39;</span><span class=\"mtk1\">);</span></span></code></pre>\n<p>It is a simple <strong>optimization tip</strong> with drastic impact on performance, recommended for <strong>processing large arrays in loop(s)</strong>.</p>\n<p>Check this <a href=\"http://jquery-howto.blogspot.in/2008/12/caching-in-jquery.html\">link</a> for performance results.</p>\n<h3 id=\"10-use-switch-case-instead-of-ifelse\" style=\"position:relative;\"><a href=\"#10-use-switch-case-instead-of-ifelse\" aria-label=\"10 use switch case instead of ifelse permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><strong>10. Use switch case instead of if/else</strong></h3>\n<p>Generally switch cases are used over if/else statements to <strong>perform almost the same tasks</strong>.</p>\n<p>The fact that in switch statements  expression to test is only evaluated once, execution time becomes less for the script compared to if/else where for every if , it has to be evaluated.</p>\n<h3 id=\"11-short-circuits-conditionals\" style=\"position:relative;\"><a href=\"#11-short-circuits-conditionals\" aria-label=\"11 short circuits conditionals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><strong>11. Short-circuits conditionals</strong></h3>\n<p>Short circuiting  is when a logical operator doesn't evaluate all its arguments.</p>\n<p>The code</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"js\" data-index=\"12\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk15\">if</span><span class=\"mtk1\"> (</span><span class=\"mtk12\">loggedin</span><span class=\"mtk1\">) { </span></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">welcome</span><span class=\"mtk1\">\\</span><span class=\"mtk11\">_messege</span><span class=\"mtk1\">();</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\"> }</span></span></code></pre>\n<p>Make it short by using combination of a verified variable and a function using <em>&#x26;&#x26;</em> (AND operator) in between both.</p>\n<p> Now above code can be made in one line</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"js\" data-index=\"13\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk12\">loggedin</span><span class=\"mtk1\"> && </span><span class=\"mtk12\">welcome</span><span class=\"mtk1\">\\</span><span class=\"mtk11\">_messege</span><span class=\"mtk1\">();</span></span></code></pre>\n<h3 id=\"12-getting-the-last-item-in-the-array\" style=\"position:relative;\"><a href=\"#12-getting-the-last-item-in-the-array\" aria-label=\"12 getting the last item in the array permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><strong>12. Getting the last item in the array</strong></h3>\n<p><em>Array.prototype.slice(begin, end)</em> is used to cut arrays when you set the start and end arguments.  But if you don't set the end argument, this function will automatically set the max value for the array.</p>\n<p>A smart hack is it can also accept negative values and by setting a negative number as begin argument, you will get the last elements from the array.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"js\" data-index=\"14\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk4\">var</span><span class=\"mtk1\"> </span><span class=\"mtk12\">array</span><span class=\"mtk1\"> = [</span><span class=\"mtk7\">1</span><span class=\"mtk1\">, </span><span class=\"mtk7\">2</span><span class=\"mtk1\">, </span><span class=\"mtk7\">3</span><span class=\"mtk1\">, </span><span class=\"mtk7\">4</span><span class=\"mtk1\">, </span><span class=\"mtk7\">5</span><span class=\"mtk1\">, </span><span class=\"mtk7\">6</span><span class=\"mtk1\">]; </span></span>\n<span class=\"grvsc-line\"><span class=\"mtk10\">console</span><span class=\"mtk1\">.</span><span class=\"mtk11\">log</span><span class=\"mtk1\">(</span><span class=\"mtk12\">array</span><span class=\"mtk1\">.</span><span class=\"mtk11\">slice</span><span class=\"mtk1\">(-</span><span class=\"mtk7\">1</span><span class=\"mtk1\">)); </span><span class=\"mtk3\">// [6] </span></span>\n<span class=\"grvsc-line\"><span class=\"mtk10\">console</span><span class=\"mtk1\">.</span><span class=\"mtk11\">log</span><span class=\"mtk1\">(</span><span class=\"mtk12\">array</span><span class=\"mtk1\">.</span><span class=\"mtk11\">slice</span><span class=\"mtk1\">(-</span><span class=\"mtk7\">2</span><span class=\"mtk1\">)); </span><span class=\"mtk3\">// [5,6] </span></span>\n<span class=\"grvsc-line\"><span class=\"mtk10\">console</span><span class=\"mtk1\">.</span><span class=\"mtk11\">log</span><span class=\"mtk1\">(</span><span class=\"mtk12\">array</span><span class=\"mtk1\">.</span><span class=\"mtk11\">slice</span><span class=\"mtk1\">(-</span><span class=\"mtk7\">3</span><span class=\"mtk1\">)); </span><span class=\"mtk3\">// [4,5,6]</span></span></code></pre>\n<h3 id=\"13-default-values-using--operator\" style=\"position:relative;\"><a href=\"#13-default-values-using--operator\" aria-label=\"13 default values using  operator permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><strong>13. Default values using || operator</strong></h3>\n<p>In JS there is a basic rule of having a default value otherwise process will halt at undefined values.</p>\n<p>To provide default value in a variable use || to stay away from this most common issue.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"js\" data-index=\"15\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk4\">var</span><span class=\"mtk1\"> </span><span class=\"mtk12\">a</span><span class=\"mtk1\"> = </span><span class=\"mtk12\">a</span><span class=\"mtk1\"> || </span><span class=\"mtk8\">&#39;hello&#39;</span></span></code></pre>\n<p>The developer must check whether there are any conflicting values that might be passed to the function to avoid Bugs.</p>\n<h3 id=\"14-beautifying-js-code\" style=\"position:relative;\"><a href=\"#14-beautifying-js-code\" aria-label=\"14 beautifying js code permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><strong>14. Beautifying JS code</strong></h3>\n<p>For beautifying your Javascript  code use <a href=\"http://jsbeautifier.org/\">jsbeautifier</a>. It formats a clumsy JS code into well structured code.</p>\n<p><strong>Code before Beautifying</strong></p>\n<p><img src=\"/ffb7a1c2536dd770e56424c03482dcb5/Beautifying-JS-code-2.webp\" alt=\"Beautifying JS code 1\"></p>\n<p><strong>Code after Beautifying</strong></p>\n<p><img src=\"/e10fa72828d50c5d23c2b68009ba432e/Beautifying-JS-code-1.webp\" alt=\"Beautifying JS code 2\"></p>\n<h3 id=\"15-checking-js-performance\" style=\"position:relative;\"><a href=\"#15-checking-js-performance\" aria-label=\"15 checking js performance permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><strong>15. Checking JS Performance</strong></h3>\n<p>To check how well a Javascript code is performing and share results use jsperf. It is easiest way to create and share testcases.</p>\n<h3 id=\"16-online-javascript-editor\" style=\"position:relative;\"><a href=\"#16-online-javascript-editor\" aria-label=\"16 online javascript editor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><strong>16. Online javascript editor</strong></h3>\n<p><a href=\"http://jsfiddle.net/\">Jsfiddle</a> and <a href=\"http://jsbin.com/\">jsbin</a> is a tool for experimenting with your Javascript code and other web languages.</p>\n<p>It is also a code sharing site. As you type into one of the editor panels the output is generated in real-time in the output panel.</p>\n<p>These are some useful hacks and tips for optimizing javascript performance. It is not mandatory to use them all the time because cases and conditions will vary. If you have tricks other than these, do share with us in comment section.</p>\n<style class=\"grvsc-styles\">\n  .grvsc-container {\n    overflow: auto;\n    -webkit-overflow-scrolling: touch;\n    padding-top: 1rem;\n    padding-top: var(--grvsc-padding-top, var(--grvsc-padding-v, 1rem));\n    padding-bottom: 1rem;\n    padding-bottom: var(--grvsc-padding-bottom, var(--grvsc-padding-v, 1rem));\n    border-radius: 8px;\n    border-radius: var(--grvsc-border-radius, 8px);\n    font-feature-settings: normal;\n  }\n  \n  .grvsc-code {\n    display: inline-block;\n    min-width: 100%;\n  }\n  \n  .grvsc-line {\n    display: inline-block;\n    box-sizing: border-box;\n    width: 100%;\n    padding-left: 1.5rem;\n    padding-left: var(--grvsc-padding-left, var(--grvsc-padding-h, 1.5rem));\n    padding-right: 1.5rem;\n    padding-right: var(--grvsc-padding-right, var(--grvsc-padding-h, 1.5rem));\n  }\n  \n  .grvsc-line-highlighted {\n    background-color: var(--grvsc-line-highlighted-background-color, transparent);\n    box-shadow: inset var(--grvsc-line-highlighted-border-width, 4px) 0 0 0 var(--grvsc-line-highlighted-border-color, transparent);\n  }\n  \n  .dark-default-dark {\n    background-color: #1E1E1E;\n    color: #D4D4D4;\n  }\n  .dark-default-dark .mtk12 { color: #9CDCFE; }\n  .dark-default-dark .mtk1 { color: #D4D4D4; }\n  .dark-default-dark .mtk8 { color: #CE9178; }\n  .dark-default-dark .mtk4 { color: #569CD6; }\n  .dark-default-dark .mtk11 { color: #DCDCAA; }\n  .dark-default-dark .mtk15 { color: #C586C0; }\n  .dark-default-dark .mtk10 { color: #4EC9B0; }\n  .dark-default-dark .mtk3 { color: #6A9955; }\n  .dark-default-dark .mtk5 { color: #D16969; }\n  .dark-default-dark .mtk7 { color: #B5CEA8; }\n</style>","frontmatter":{"title":"Javascript tips and tricks to Optimize Performance","author":{"id":"Team LoginRadius","github":"LoginRadius","avatar":null},"date":"April 07, 2017","updated_date":null,"tags":["Engineering","JavaScript","Hacks","Array"],"coverImage":{"childImageSharp":{"fluid":{"aspectRatio":1.3793103448275863,"src":"/static/0d6472e55ba0b111b3dfa895ec2dec57/7f8e9/16-JavaScript-Hacks-to-save-time-and-boost-productivity-768x555.webp","srcSet":"/static/0d6472e55ba0b111b3dfa895ec2dec57/61e93/16-JavaScript-Hacks-to-save-time-and-boost-productivity-768x555.webp 200w,\n/static/0d6472e55ba0b111b3dfa895ec2dec57/1f5c5/16-JavaScript-Hacks-to-save-time-and-boost-productivity-768x555.webp 400w,\n/static/0d6472e55ba0b111b3dfa895ec2dec57/7f8e9/16-JavaScript-Hacks-to-save-time-and-boost-productivity-768x555.webp 768w","sizes":"(max-width: 768px) 100vw, 768px"}}}},"fields":{"authorId":"Team LoginRadius","slug":"/engineering/16-javascript-hacks-for-optimization/"}}},{"node":{"id":"4f0874cc-37a2-52c9-b338-18f7a7e1307d","html":"<p>Gone are the days when learning coding or programming was reserved for the geeks or nerds. The case is exactly different nowadays. The latest buzz of “How to code” is here to stay. Making sure that you have little coding knowledge under your belt is proving to be an incredible skill no matter whether you are a marketer or an entrepreneur or a member of any of business team. Talk to any entrepreneur, marketer or freelancer, you will get an idea about learning coding will help you get through. The reasons are more than one! Half of the 2016 is gone, so if you haven’t included this incredible skill in your 2017’s new year resolution, you need to reconsider. Here is why!</p>\n<h3 id=\"why\" style=\"position:relative;\"><a href=\"#why\" aria-label=\"why permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><strong>Why?</strong></h3>\n<p>With softwares ruling the digital world, the demand of learning coding is becoming must for every professionals in every field whether it is marketing, technology, commerce, finance and what not. As the digital age is making us more and more dependant on computer softwares for business, learning to code has become helpful here. Learn to code is already in the must have technical skills list of 21st century and this demand of technical skills is growing like never before.</p>\n<p>Coding is problem solving. Coding is no different than the way you can fuel up your car, check the oil and get it serviced by reading the manual you are provided with. But coding takes you a long way ahead. It is beyond these simple things. It teaches you to repaint your car, customize the engine to make it work in the way you want. Hope you got an idea why coding is important and why you should also learn it.</p>\n<h3 id=\"you-are-convinced-now-what\" style=\"position:relative;\"><a href=\"#you-are-convinced-now-what\" aria-label=\"you are convinced now what permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><strong>You are convinced! Now what?</strong></h3>\n<ul>\n<li>Did you know Bill Gates, got into programming at a very early age? The reason being his prep school used to provide students access to GE Mainframe Computer.</li>\n<li>Similarly the owner of Facebook, Mark Zuckerberg, hired a private programming tutor to learn the same while growing up.</li>\n</ul>\n<p>Yeah, yeah, I know this coding thing is not the only factor behind their success (or should I say making them billionaire), but it didn’t hurt either.</p>\n<p>But unlike them, most of us were not gifted with this kind of exposure to the digital world and most of us are still naive to how the world of programming works. Many of the people around are still wondering how to write and combine the long string of code to create a beautiful website, app and more! And trust me you are not alone!</p>\n<p>But don’t worry because with so many information available online, you can also master the same. No need to spend a lot of money or put yourself in debt in coding learning, as these resources are definitely going to help you to get through this.</p>\n<h3 id=\"10-handful-resources-to-make-the-process-of-learning-coding-easier\" style=\"position:relative;\"><a href=\"#10-handful-resources-to-make-the-process-of-learning-coding-easier\" aria-label=\"10 handful resources to make the process of learning coding easier permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><strong>10 handful resources to make the process of learning coding easier!</strong></h3>\n<h4 id=\"1codecademy-\" style=\"position:relative;\"><a href=\"#1codecademy-\" aria-label=\"1codecademy  permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><strong>1. <a href=\"https://www.codecademy.com/\">Codecademy</a></strong> <strong>:</strong></h4>\n<p><strong>Price</strong> - Free but pro-version also available at $19.99/moPro for $19.99/moPro for $19.99/mo</p>\n<p>Codecademy - Teaching the world how to code, definitely tops my list while talking about the top resources for how to learn programming. Currently owning around 25 million users, one can start learning as soon as he registers himself on the website. They can learn to design websites with HTML, CSS and also customize it with Javascript.</p>\n<p>The courses provided are not lecture style but the students actually get to do hands on coding and witness changes real time. Sims, the owner of Codecademy says that the website allows students to learn the coding by providing preview for every line they write immediately instead of watching an instructor. Apart from that, Codecademy also provides students access to QnA forums and groups to learn on topics like Python, Ruby on Rails, Etsy, etc.</p>\n<p><strong>2. <a href=\"https://www.w3schools.com/\">W3schools</a></strong> <strong>:</strong></p>\n<p><strong>Price</strong> : Free</p>\n<p>W3schools - the largest web developer site, as they define it, provides free tutorials on JavaScript, HTML, CSS, jQuery and what not along with lot of references. So if you want to know what <div> means, it will quickly show up that “<div> defines a division or section in HTML document.”</p>\n<h4 id=\"3tuts-\" style=\"position:relative;\"><a href=\"#3tuts-\" aria-label=\"3tuts  permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><strong>3. <a href=\"https://tutsplus.com/\">Tuts+</a></strong> <strong>:</strong></h4>\n<h4 id=\"price--15mo-and-pro-version-at-360year\" style=\"position:relative;\"><a href=\"#price--15mo-and-pro-version-at-360year\" aria-label=\"price  15mo and pro version at 360year permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><strong>Price</strong> : $15/mo and pro version at $360/year</h4>\n<p>The website provides tiered subscription plan that allows users to download multiple ebooks too along with the course. The ebook comprises of a huge catalog that comes with different code specifics like Jekyll, Sass, SVG, etc. I should definitely not forget to mention that even professionals can take the ongoing education courses to brush up their programming skills. The website provides learner tutorials in the form of write-ups about various topics.</p>\n<p><strong>Price</strong> : Free but pro version available at $29/mo</p>\n<p>The famous e-learning course provider offers a wide range of courses in several types of programming languages, web tools and designing. The website offers both free as well as paid versions. With free version users can get access to the 10 introductory courses that include topics like SQL, Objective C, jQuery which are great for getting started. While with the paid version, users can get access to 200 videos and 50+ interesting courses. The website basically works on learn, practice, win and track model which means first the users can learn via watching videos and then challenges are placed in front of them to track their learning experience.</p>\n<h4 id=\"5khan-academy-\" style=\"position:relative;\"><a href=\"#5khan-academy-\" aria-label=\"5khan academy  permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><strong>5. <a href=\"https://www.khanacademy.org/\">Khan Academy</a></strong> <strong>:</strong></h4>\n<p><strong>Price</strong> : Free</p>\n<p>The academy is best for those who prefer short videos to learn things. Started in 2006, by Salman Khan, the idea of this website was generated after creating and sharing video tutorials on Youtube. One of the original e-courses providers, the Khan Academy has become widely popular over the years and offers courses in numerous programming languages, both for beginners as well as experts. Relying heavily on videos, users can learn to code animations, games, drawings and a lot more. For those who are planning to start their coding career, or are beginners at coding, the Khan Academy is the best place.</p>\n<h4 id=\"6treehouse-\" style=\"position:relative;\"><a href=\"#6treehouse-\" aria-label=\"6treehouse  permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><strong>6. <a href=\"https://teamtreehouse.com/\">Treehouse</a></strong> <strong>:</strong></h4>\n<p><strong>Price</strong> : Free trial for 2 weeks, Basic version at $25/mo and pro version at $50/mo</p>\n<p>The online technology courses provider, Treehouse provides programming courses for both beginners as well as experts. The website works on learn, practice and earn model. With 222+ courses, videos, challenges, the website makes sure that the learners are kept busy. Apart from that, it also helps you learn new business strategies to make the best out of your knowledge. But unlike above mentioned options, for this one, you need to spend some cash before you go ahead. The basic version comes at $25/mo with which you get access to around 1000+ videos and can take interesting challenges. While if you go for the pro version at around $50/mo users can unlock the bonus content and download videos to watch offline too.</p>\n<h4 id=\"7codeorg-\" style=\"position:relative;\"><a href=\"#7codeorg-\" aria-label=\"7codeorg  permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><strong>7. <a href=\"https://code.org/\">Code.org</a></strong> <strong>:</strong></h4>\n<p><strong>Price</strong> : Free</p>\n<p>Another player in the field of online coding courses, the website’s mission is to provide more and more people opportunity to learn programming. The website works more like games with drag &#x26; drop tiles. Learners can see the code both during challenge as well as when it is completed.</p>\n<p>The next three in the list are massive open online courses provider ie MOOC. These websites provide courses related to not only coding but other fields too like life science, engineering, health habits, etc.</p>\n<h4 id=\"8coursera-\" style=\"position:relative;\"><a href=\"#8coursera-\" aria-label=\"8coursera  permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><strong>8. <a href=\"https://www.coursera.org/\">Coursera</a></strong> <strong>:</strong></h4>\n<p><strong>Price</strong> : Both free and paid</p>\n<p>Despite of being founded just 4 years ago, Coursera has become a major Major Open Online Courses provider that offers around 1990 courses from 119 well known institutions. Though there are certain programs that require you to spend money to get certified, there are hundred of other free introductory courses that provide specializations from well known universities like University of Toronto and Vanderbilt, etc. One of the widely popular MOOCs provided by Coursera is “<a href=\"https://www.coursera.org/learn/python\">Programming for everybody (Getting started with Python)</a></p>\n<h4 id=\"9udemy-\" style=\"position:relative;\"><a href=\"#9udemy-\" aria-label=\"9udemy  permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><strong>9. <a href=\"https://www.udemy.com/\">Udemy</a></strong> <strong>:</strong></h4>\n<p><strong>Price</strong> : Free to hundreds of dollars</p>\n<p>Another MOOC provider, Udemy is one place you can find resources for just anything. It is a great place to develop your coding skills with courses like <a href=\"https://www.udemy.com/java-the-complete-java-developer-course/\">Complete Java Developer Course</a>. Though the courses fee varies from free to hundreds of dollars, Udemy has created its own position when it comes to learning programming<strong>.</strong> Another feature that it brings along is to allow user to sign up as an instructor and create his/her own course.</p>\n<h4 id=\"10edx-\" style=\"position:relative;\"><a href=\"#10edx-\" aria-label=\"10edx  permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><strong>10. <a href=\"https://www.edx.org/\">edX</a></strong> <strong>:</strong></h4>\n<p><strong>Price</strong> : Free</p>\n<p>Similar to above, this one is also a MOOC provider, serving millions of students around the globe. But this one is a non profit and open source which means anyone can build his own tools and contribute to the edX platform. Some of the most popular edX course is “Fundamentals of Computer Science” by IIT Bombay. Most of the courses I found here were free, but to get a verified certificate you need to spend some cash which differs between the type of courses you are enrolled with.</p>\n<p>Though there are hundreds of other websites that help you to enhance your coding skills, these are the top ten sites I found to be the best. Have you tried any of these? How was your experience? I would love to know about it in the comments below.</p>\n<style class=\"grvsc-styles\">\n  .grvsc-container {\n    overflow: auto;\n    -webkit-overflow-scrolling: touch;\n    padding-top: 1rem;\n    padding-top: var(--grvsc-padding-top, var(--grvsc-padding-v, 1rem));\n    padding-bottom: 1rem;\n    padding-bottom: var(--grvsc-padding-bottom, var(--grvsc-padding-v, 1rem));\n    border-radius: 8px;\n    border-radius: var(--grvsc-border-radius, 8px);\n    font-feature-settings: normal;\n  }\n  \n  .grvsc-code {\n    display: inline-block;\n    min-width: 100%;\n  }\n  \n  .grvsc-line {\n    display: inline-block;\n    box-sizing: border-box;\n    width: 100%;\n    padding-left: 1.5rem;\n    padding-left: var(--grvsc-padding-left, var(--grvsc-padding-h, 1.5rem));\n    padding-right: 1.5rem;\n    padding-right: var(--grvsc-padding-right, var(--grvsc-padding-h, 1.5rem));\n  }\n  \n  .grvsc-line-highlighted {\n    background-color: var(--grvsc-line-highlighted-background-color, transparent);\n    box-shadow: inset var(--grvsc-line-highlighted-border-width, 4px) 0 0 0 var(--grvsc-line-highlighted-border-color, transparent);\n  }\n  \n</style>","frontmatter":{"title":"Learn How To Code Using The 10 Cool Websites","author":{"id":"Team LoginRadius","github":"LoginRadius","avatar":null},"date":"October 21, 2016","updated_date":null,"tags":["Courses","Learning Websites"],"coverImage":{"childImageSharp":{"fluid":{"aspectRatio":1.3605442176870748,"src":"/static/984ce3cc0d4c43ee0925e08cc7b336fc/403a4/How-to-code-using-the-10-cool-websites-768x564-300x220.webp","srcSet":"/static/984ce3cc0d4c43ee0925e08cc7b336fc/61e93/How-to-code-using-the-10-cool-websites-768x564-300x220.webp 200w,\n/static/984ce3cc0d4c43ee0925e08cc7b336fc/403a4/How-to-code-using-the-10-cool-websites-768x564-300x220.webp 300w","sizes":"(max-width: 300px) 100vw, 300px"}}}},"fields":{"authorId":"Team LoginRadius","slug":"/engineering/learn-to-code-using-10-websites/"}}},{"node":{"id":"cb3fdb4b-d6e4-5802-b360-5519dcdd0623","html":"<p>In this blog, I will cover some of my favorite Sublime features. Use of these plugins will dramatically reduce the amount of tedious tasks you have to perform, and make your worktime really fun. I will start with some of the most basic features that come with fresh installation of Sublime. There are lots of good tutorials on Sublime shortcuts and plugins on the internet, but I feel there should be more about these fundamental features. I have seen many people who are familiar with the plugins but not with these cool built-in features. In this article we will be introducing \"Snippets\", \"Project\" and \"Macros\".</p>\n<p>Here we go:</p>\n<h3 id=\"snippets\" style=\"position:relative;\"><a href=\"#snippets\" aria-label=\"snippets permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Snippets</h3>\n<p><img src=\"/3e21aab686b29a54a248ccd545aca465/snippet-demo.gif\" alt=\"snippet-demo\"></p>\n<p>Back when i introduced Sublime editor to my friends,\"Snippets\" was among the first few features which really intrigued them. To give a quick peek what a snippet looks like:  </p>\n<p>This is definitely the feature you will use the most! To start using snippets, you can either create your own snippets according to your needs or download some ready-made snippets created by others to fulfill some generic coding needs. Like the one I demonstrated, it is pre-made from a plugin called <code>Html Page Snippets</code>, and command <code>docjq</code> will create a boiler template for a Html page that contains bootstrap and jQuery.</p>\n<p><img src=\"/0300880eed77c65d2c7b959aca04ee17/new-snippet.webp\" alt=\"new-snippet\"></p>\n<p>To create your own snippet, go to \"Tools\" => \"New Snippet\", an interface to create your own snippet will pop up, it would look something like this:  </p>\n<ul>\n<li>Replace the default line with your snippet, the default one looks like this:</li>\n</ul>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"\" data-index=\"0\"><code class=\"grvsc-code\"><span class=\"grvsc-line\">Hello, ${1:this} is a ${2:snippet}.</span></code></pre>\n<p>Note: The dollar sign \"$\" allows you to use tab key to jump between, so set it wisely!</p>\n<ul>\n<li>Uncomment this line to set up a tab trigger for the shortcut</li>\n</ul>\n<p>Now save it, but keep in mind putting it in the correct location is important!</p>\n<p>If you can not find it, go to \"Sublime\" - > \"Preferences\" -> \"Browse Packages\", and create a folder called \"User\" if there isn't one already, and save it there.</p>\n<p><img src=\"/30a6ed6b40f11c0e5690a68bda1f31ef/browse-package.webp\" alt=\"browse-package\"></p>\n<h3 id=\"project\" style=\"position:relative;\"><a href=\"#project\" aria-label=\"project permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Project</h3>\n<p>Using \"Project\" feature to organize your projects is super easy and handy. It saves a lot of time that you'd normally waste finding different folders and then dragging and dropping to your Sublime each time. Additionally, it saves your previous location so you can just pick up where you left off. Let's see a quick demo:</p>\n<p>Saving and using your projects is very straightforward.</p>\n<ul>\n<li>First drag some folders and files that you want to open into Sublime</li>\n<li>\n<p>Then go to the menu, click \"Project\" -> \"Save Project As\"  </p>\n<p><img src=\"/70e0570d0894195bc9d3e2e1c5e52dfb/save-proj.webp\" alt=\"save-proj\"></p>\n</li>\n<li>Note the extension is \".sublime-project\" and you may want to put all your project files in one central location</li>\n</ul>\n<p>That's it! You're done! Super easy right?</p>\n<h3 id=\"macros\" style=\"position:relative;\"><a href=\"#macros\" aria-label=\"macros permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Macros</h3>\n<p><img src=\"/e8a218bdc92e2c8c118faeb6fec384e0/without-macro.gif\" alt=\"without-macro\"></p>\n<p>Do you always feel frustrated by repeating the same tedious task again &#x26; again? Hmm... at least that's how I feel when I need to covert a vertical line of data into an array. Tasks like these are pretty common when you need to copy a line of data from spreadsheets. Using shortcuts, the best way I can come up with to accomplish this would be like so:  </p>\n<p>It takes about 8 shortcuts to finish each process, that's including the first paste action and then adding a space character after each comma. Imagine having to do this for each line of a table, and for every single spreadsheet you have to work on. It would be hundreds of shortcuts you need to press and each time you are just repeating the exact same sequence of keys.</p>\n<p><img src=\"/b799f564f4bd2661de161e21af25fea4/start-macro.webp\" alt=\"start-macro\"></p>\n<p>Well you might think there must be a better way! You bet there is! \"Macros\" are designed to handle this kind of nasty situation and save you from all that boring work. Here I made a very quick and easy example, it converts a vertical line of data into an array:  </p>\n<p>Magic! Lots of time and lives will be saved by this little gadget. So now, how to make your very own macros. First of all I would recommend trying out your set of operations several times to make sure it will get recorded correctly. When you are ready, open a new window/tab in Sublime, clear your mind, take several deep breaths, and here we go.</p>\n<ul>\n<li>\n<p>Go to \"Tools\" -> \"Record Mac  </p>\n<p><img src=\"/b799f564f4bd2661de161e21af25fea4/start-macro1.webp\" alt=\"start-macro1\"></p>\n</li>\n<li>Do your operations</li>\n</ul>\n<p>Usually you would have something copied in your clipboard, so it could start with a \"Paste\" command. Now it's your time to shine, do a clean and precise set of operations to format the data.</p>\n<ul>\n<li>\n<p>Stop your macro  </p>\n<p><img src=\"/eb5135b0cb78399916eda6245eb93e69/stop-macro.webp\" alt=\"stop-macro\"></p>\n</li>\n<li>Playback</li>\n</ul>\n<p>You can find it under the same \"Tools\" menu. Just use it to make sure it did what you want, sometimes even though you recorded it properly, the macro doesn't recognize the operations correctly. For this reason it's important to make sure everything is correct and smooth, and if it's not, try find some alternatives for your operations.</p>\n<ul>\n<li>Save It!</li>\n</ul>\n<p>Similar to other Sublime tools, it will be saved with an extension called \".sublime-macro\", after it gets saved you will be able to find it in your Macro User List.</p>\n<h3 id=\"to-be-continued-\" style=\"position:relative;\"><a href=\"#to-be-continued-\" aria-label=\"to be continued  permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>To Be Continued ..</h3>\n<p>I hope you had fun and learned something new about Sublime. Next time we will cover some really good packages/plugins that you should consider using to make your life and work even simpler.\nHappy coding!!!</p>\n<style class=\"grvsc-styles\">\n  .grvsc-container {\n    overflow: auto;\n    -webkit-overflow-scrolling: touch;\n    padding-top: 1rem;\n    padding-top: var(--grvsc-padding-top, var(--grvsc-padding-v, 1rem));\n    padding-bottom: 1rem;\n    padding-bottom: var(--grvsc-padding-bottom, var(--grvsc-padding-v, 1rem));\n    border-radius: 8px;\n    border-radius: var(--grvsc-border-radius, 8px);\n    font-feature-settings: normal;\n  }\n  \n  .grvsc-code {\n    display: inline-block;\n    min-width: 100%;\n  }\n  \n  .grvsc-line {\n    display: inline-block;\n    box-sizing: border-box;\n    width: 100%;\n    padding-left: 1.5rem;\n    padding-left: var(--grvsc-padding-left, var(--grvsc-padding-h, 1.5rem));\n    padding-right: 1.5rem;\n    padding-right: var(--grvsc-padding-right, var(--grvsc-padding-h, 1.5rem));\n  }\n  \n  .grvsc-line-highlighted {\n    background-color: var(--grvsc-line-highlighted-background-color, transparent);\n    box-shadow: inset var(--grvsc-line-highlighted-border-width, 4px) 0 0 0 var(--grvsc-line-highlighted-border-color, transparent);\n  }\n  \n  .dark-default-dark {\n    background-color: #1E1E1E;\n    color: #D4D4D4;\n  }\n</style>","frontmatter":{"title":"Beginner's Guide for Sublime Text 3 Plugins","author":{"id":"Team LoginRadius","github":"LoginRadius","avatar":null},"date":"November 10, 2015","updated_date":null,"tags":["SublimeText","CodeEditor"],"coverImage":{"childImageSharp":{"fluid":{"aspectRatio":1,"src":"/static/296e569fc8dd1576c6df798847aaf8ad/7fbdd/Beginner-Guide-Sublime-Text.webp","srcSet":"/static/296e569fc8dd1576c6df798847aaf8ad/61e93/Beginner-Guide-Sublime-Text.webp 200w,\n/static/296e569fc8dd1576c6df798847aaf8ad/1f5c5/Beginner-Guide-Sublime-Text.webp 400w,\n/static/296e569fc8dd1576c6df798847aaf8ad/7fbdd/Beginner-Guide-Sublime-Text.webp 610w","sizes":"(max-width: 610px) 100vw, 610px"}}}},"fields":{"authorId":"Team LoginRadius","slug":"/engineering/beginners-guide-for-sublime-text-3-part-2/"}}},{"node":{"id":"89af2503-02c3-5a54-aa6f-1c581d095b2d","html":"<p>This tutorial provides a solution to get email alerts, when a unhandled error occurs. For this tutorial, we are using WordPress.</p>\n<p>Imagine you created a php application and it’s running fine.  A couple of days later, a user complains about an error which you’re totally unaware of. Such unhandled errors are very common in php applications. So, to find these issues, we are going to send email notifications whenever an error occurs.</p>\n<p><strong>Step 1.</strong> First of all we need to identify a common application file that include at top of application. in this case the file is “wp-config.php” at the root of your wordpress hosting directory.  </p>\n<p><strong>Step 2.</strong> Let’s add the following line of code in this file under php tag.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"php\" data-index=\"0\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk11\">set_error_handler</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&#39;errorHandler&#39;</span><span class=\"mtk1\">); </span><span class=\"mtk3\">// this line of code sets an error handler custom function to handle any php error. And here we pass our custom function that name “errorHandler”</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk4\">function</span><span class=\"mtk1\"> </span><span class=\"mtk11\">createTable</span><span class=\"mtk1\">(</span><span class=\"mtk12\">$array</span><span class=\"mtk1\">){</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk15\">if</span><span class=\"mtk1\">(</span><span class=\"mtk11\">is_array</span><span class=\"mtk1\">(</span><span class=\"mtk12\">$array</span><span class=\"mtk1\">) && </span><span class=\"mtk11\">count</span><span class=\"mtk1\">(</span><span class=\"mtk12\">$array</span><span class=\"mtk1\">)&gt;</span><span class=\"mtk7\">0</span><span class=\"mtk1\">){</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk12\">$errorContent</span><span class=\"mtk1\"> = </span><span class=\"mtk8\">&quot;&lt;table border = 1&gt;&lt;tr&gt;&lt;td&gt;&quot;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk15\">foreach</span><span class=\"mtk1\"> (</span><span class=\"mtk12\">$array</span><span class=\"mtk1\"> as </span><span class=\"mtk12\">$key</span><span class=\"mtk1\"> =&gt; </span><span class=\"mtk12\">$val</span><span class=\"mtk1\">) {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">            </span><span class=\"mtk12\">$errorContent</span><span class=\"mtk1\"> .= </span><span class=\"mtk12\">$key</span><span class=\"mtk1\"> . </span><span class=\"mtk8\">&quot;&lt;/td&gt;&lt;td&gt;&quot;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">            </span><span class=\"mtk15\">if</span><span class=\"mtk1\">(</span><span class=\"mtk11\">is_array</span><span class=\"mtk1\">(</span><span class=\"mtk12\">$val</span><span class=\"mtk1\">) && </span><span class=\"mtk11\">count</span><span class=\"mtk1\">(</span><span class=\"mtk12\">$val</span><span class=\"mtk1\">)&gt;</span><span class=\"mtk7\">0</span><span class=\"mtk1\">){</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">                </span><span class=\"mtk12\">$errorContent</span><span class=\"mtk1\"> .= </span><span class=\"mtk11\">createTable</span><span class=\"mtk1\">(</span><span class=\"mtk11\">json_decode</span><span class=\"mtk1\">(</span><span class=\"mtk11\">json_encode</span><span class=\"mtk1\">(</span><span class=\"mtk12\">$val</span><span class=\"mtk1\">),</span><span class=\"mtk4\">true</span><span class=\"mtk1\">)) ;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">            }</span><span class=\"mtk15\">else</span><span class=\"mtk1\">{</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">                </span><span class=\"mtk12\">$errorContent</span><span class=\"mtk1\"> .= </span><span class=\"mtk11\">print_r</span><span class=\"mtk1\">(</span><span class=\"mtk12\">$val</span><span class=\"mtk1\">, </span><span class=\"mtk4\">true</span><span class=\"mtk1\">) ;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">            }</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        }</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk12\">$errorContent</span><span class=\"mtk1\"> .= </span><span class=\"mtk8\">&quot;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&quot;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk15\">return</span><span class=\"mtk1\"> </span><span class=\"mtk12\">$errorContent</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    }</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk15\">return</span><span class=\"mtk1\"> </span><span class=\"mtk8\">&#39;&#39;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\"> </span></span>\n<span class=\"grvsc-line\"><span class=\"mtk3\">/**</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk3\"> * </span></span>\n<span class=\"grvsc-line\"><span class=\"mtk3\"> * </span><span class=\"mtk4\">@param</span><span class=\"mtk3\"> </span><span class=\"mtk10\">type</span><span class=\"mtk3\"> $errorNumber        // This parameter returns error number.</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk3\"> * </span><span class=\"mtk4\">@param</span><span class=\"mtk3\"> </span><span class=\"mtk10\">type</span><span class=\"mtk3\"> $errorString           // This parameter returns error string.</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk3\"> * </span><span class=\"mtk4\">@param</span><span class=\"mtk3\"> </span><span class=\"mtk10\">type</span><span class=\"mtk3\"> $errorFile               // This parameter returns path of file in which error found.</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk3\"> * </span><span class=\"mtk4\">@param</span><span class=\"mtk3\"> </span><span class=\"mtk10\">type</span><span class=\"mtk3\"> $errorLine              // This parameter returns line number of file in which you get an error.</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk3\"> * </span><span class=\"mtk4\">@param</span><span class=\"mtk3\"> </span><span class=\"mtk10\">type</span><span class=\"mtk3\"> $errorContext         // This parameter return error context.</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk3\"> */</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk4\">function</span><span class=\"mtk1\"> </span><span class=\"mtk11\">errorHandler</span><span class=\"mtk1\">(</span><span class=\"mtk12\">$errorNumber</span><span class=\"mtk1\">,</span><span class=\"mtk12\"> $errorString</span><span class=\"mtk1\">,</span><span class=\"mtk12\"> $errorFile</span><span class=\"mtk1\">,</span><span class=\"mtk12\"> $errorLine</span><span class=\"mtk1\">,</span><span class=\"mtk12\"> $errorContext</span><span class=\"mtk1\">) {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">$emailAddress</span><span class=\"mtk1\"> = </span><span class=\"mtk8\">&#39;example@example.com&#39;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">$emailSubject</span><span class=\"mtk1\"> = </span><span class=\"mtk8\">&#39;Error on my Application&#39;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">$emailMessage</span><span class=\"mtk1\"> = </span><span class=\"mtk8\">&#39;&lt;h2&gt;Error Reporting on :- &lt;/h2&gt;[&#39;</span><span class=\"mtk1\"> . </span><span class=\"mtk11\">date</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&quot;Y-m-d h:i:s&quot;</span><span class=\"mtk1\">, </span><span class=\"mtk11\">time</span><span class=\"mtk1\">()) . </span><span class=\"mtk8\">&#39;]&#39;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">$emailMessage</span><span class=\"mtk1\"> .= </span><span class=\"mtk8\">&quot;&lt;h2&gt;Error Number :- &lt;/h2&gt;&quot;</span><span class=\"mtk1\">.</span><span class=\"mtk11\">print_r</span><span class=\"mtk1\">(</span><span class=\"mtk12\">$errorNumber</span><span class=\"mtk1\">, </span><span class=\"mtk4\">true</span><span class=\"mtk1\">).</span><span class=\"mtk8\">&#39;&#39;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">$emailMessage</span><span class=\"mtk1\"> .= </span><span class=\"mtk8\">&quot;&lt;h2&gt;Error String :- &lt;/h2&gt;&quot;</span><span class=\"mtk1\">.</span><span class=\"mtk11\">print_r</span><span class=\"mtk1\">(</span><span class=\"mtk12\">$errorString</span><span class=\"mtk1\">, </span><span class=\"mtk4\">true</span><span class=\"mtk1\">).</span><span class=\"mtk8\">&#39;&#39;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">$emailMessage</span><span class=\"mtk1\"> .= </span><span class=\"mtk8\">&quot;&lt;h2&gt;Error File :- &lt;/h2&gt;&quot;</span><span class=\"mtk1\">.</span><span class=\"mtk11\">print_r</span><span class=\"mtk1\">(</span><span class=\"mtk12\">$errorFile</span><span class=\"mtk1\">, </span><span class=\"mtk4\">true</span><span class=\"mtk1\">).</span><span class=\"mtk8\">&#39;&#39;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">$emailMessage</span><span class=\"mtk1\"> .= </span><span class=\"mtk8\">&quot;&lt;h2&gt;Error Line :- &lt;/h2&gt;&quot;</span><span class=\"mtk1\">.</span><span class=\"mtk11\">print_r</span><span class=\"mtk1\">(</span><span class=\"mtk12\">$errorLine</span><span class=\"mtk1\">, </span><span class=\"mtk4\">true</span><span class=\"mtk1\">).</span><span class=\"mtk8\">&#39;&#39;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">$emailMessage</span><span class=\"mtk1\"> .= </span><span class=\"mtk8\">&quot;&lt;h2&gt;Error Context :- &lt;/h2&gt;&quot;</span><span class=\"mtk1\">.</span><span class=\"mtk11\">createTable</span><span class=\"mtk1\">(</span><span class=\"mtk12\">$errorContext</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">$headers</span><span class=\"mtk1\"> = </span><span class=\"mtk8\">&quot;MIME-Version: 1.0&quot;</span><span class=\"mtk1\"> . </span><span class=\"mtk8\">&quot;rn&quot;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">$headers</span><span class=\"mtk1\"> .= </span><span class=\"mtk8\">&quot;Content-type:text/html;charset=UTF-8&quot;</span><span class=\"mtk1\"> . </span><span class=\"mtk8\">&quot;rn&quot;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk11\">mail</span><span class=\"mtk1\">(</span><span class=\"mtk12\">$emailAddress</span><span class=\"mtk1\">, </span><span class=\"mtk12\">$emailSubject</span><span class=\"mtk1\">, </span><span class=\"mtk12\">$emailMessage</span><span class=\"mtk1\">, </span><span class=\"mtk12\">$headers</span><span class=\"mtk1\">); </span><span class=\"mtk3\">// you may use SMTP, default php mail service OR other email sending process</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span></code></pre>\n<p><strong>Step 3.</strong> Now save the file and upload on server.</p>\n<p>Whenever we got any error in wordpress then above code will send an email to given email-address (example@example.com). You can use the above code on production websites to improve application performance and track all errors that’s are missed.</p>\n<p>Similarly we can use above code in drupal, joomla, and many other content management systems.<br>\nCommon config files on other platforms are listed below:</p>\n<table>\n<thead>\n<tr>\n<th><strong>CMS/application name</strong></th>\n<th><strong>Location of common file</strong></th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>4Images Gallery</td>\n<td>/config.php</td>\n</tr>\n<tr>\n<td>B2 Evolution</td>\n<td>/conf/_basic_config.php</td>\n</tr>\n<tr>\n<td>Boonex Dolphin</td>\n<td>/inc/header.inc.php</td>\n</tr>\n<tr>\n<td>Concrete5</td>\n<td>/config/site.php</td>\n</tr>\n<tr>\n<td>Coppermine Photo Gallery</td>\n<td>/include/config.inc.php</td>\n</tr>\n<tr>\n<td>Crafty Syntax Live Help</td>\n<td>/config.php</td>\n</tr>\n<tr>\n<td>Cube Cart</td>\n<td>/includes/global.inc.php</td>\n</tr>\n<tr>\n<td>dotProject</td>\n<td>/includes/config.php</td>\n</tr>\n<tr>\n<td>Drupal</td>\n<td>/sites/default/settings.php</td>\n</tr>\n<tr>\n<td>e107</td>\n<td>/e107_config.php</td>\n</tr>\n<tr>\n<td>FAQMasterFlex</td>\n<td>/faq_config.php</td>\n</tr>\n<tr>\n<td>Gallery</td>\n<td>/config.php</td>\n</tr>\n<tr>\n<td>Geeklog</td>\n<td>/db-config.php or /siteconfig.php or /lib-common.php</td>\n</tr>\n<tr>\n<td>glfusion</td>\n<td>/private/db-config.php</td>\n</tr>\n<tr>\n<td>Hotaru</td>\n<td>/hotaru_settings.php</td>\n</tr>\n<tr>\n<td>Joomla</td>\n<td>/configuration.php</td>\n</tr>\n<tr>\n<td>LiveSite</td>\n<td>/livesite/config.php</td>\n</tr>\n<tr>\n<td>LifeType</td>\n<td>/config/config.properties.php</td>\n</tr>\n<tr>\n<td>Mambo</td>\n<td>/configuration.php</td>\n</tr>\n<tr>\n<td>Marketecture</td>\n<td>/include/config.php</td>\n</tr>\n<tr>\n<td>MODx</td>\n<td>/manager/includes/config.inc.php</td>\n</tr>\n<tr>\n<td>Moodle</td>\n<td>/config.php</td>\n</tr>\n<tr>\n<td>MyBB</td>\n<td>/inc/config.php</td>\n</tr>\n<tr>\n<td>Noahs Classifieds</td>\n<td>/app/config.php</td>\n</tr>\n<tr>\n<td>Nucleus</td>\n<td>/config.php</td>\n</tr>\n<tr>\n<td>ocPortal</td>\n<td>/info.php</td>\n</tr>\n<tr>\n<td>OpenCart</td>\n<td>/config.php or /admin/config.php</td>\n</tr>\n<tr>\n<td>osCommerce</td>\n<td>/includes/configure.php or /admin/includes/configure.php</td>\n</tr>\n<tr>\n<td>Oxwall</td>\n<td>/ow_includes/config.php</td>\n</tr>\n<tr>\n<td>PHP-Nuke</td>\n<td>/config.php</td>\n</tr>\n<tr>\n<td>phpBB</td>\n<td>/config.php</td>\n</tr>\n<tr>\n<td>phpFormGenerator</td>\n<td>/index.php or /mysql.class.php</td>\n</tr>\n<tr>\n<td>phpFreeChat</td>\n<td>/forms/admin/config.inc.php (only if you have saved form input to a database)</td>\n</tr>\n<tr>\n<td>PHPlist</td>\n<td>/config/config.php</td>\n</tr>\n<tr>\n<td>phpMyDirectory</td>\n<td>/defaults.php</td>\n</tr>\n<tr>\n<td>phpWCMS</td>\n<td>/include/inc_conf/conf.inc.php</td>\n</tr>\n<tr>\n<td>phpWebSite</td>\n<td>/conf/config.php</td>\n</tr>\n<tr>\n<td>PhpWiki</td>\n<td>/admin.php or /lib/config.php</td>\n</tr>\n<tr>\n<td>Pligg</td>\n<td>/libs/dbconnect.php</td>\n</tr>\n<tr>\n<td>Post-Nuke</td>\n<td>/config.php</td>\n</tr>\n<tr>\n<td>PrestaShop</td>\n<td>/config/settings.inc.php</td>\n</tr>\n<tr>\n<td>Saurus CMS</td>\n<td>/config.php</td>\n</tr>\n<tr>\n<td>ShopSite</td>\n<td>/includes/configure.php or /admin/includes/configure.php</td>\n</tr>\n<tr>\n<td>Siteframe</td>\n<td>/config.php</td>\n</tr>\n<tr>\n<td>Simple Machines Forum</td>\n<td>/Settings.php</td>\n</tr>\n<tr>\n<td>Soholaunch</td>\n<td>/sohoadmin/config/isp.conf.php</td>\n</tr>\n<tr>\n<td>SugarCRM</td>\n<td>/config.php</td>\n</tr>\n<tr>\n<td>Textpattern</td>\n<td>/textpattern/config.php</td>\n</tr>\n<tr>\n<td>TikiWiki</td>\n<td>/db/local.php</td>\n</tr>\n<tr>\n<td>Tomato Cart</td>\n<td>/includes/configure.php</td>\n</tr>\n<tr>\n<td>TYPO3</td>\n<td>/typo3conf/localconf.php</td>\n</tr>\n<tr>\n<td>WebCalendar</td>\n<td>/includes/settings.php</td>\n</tr>\n<tr>\n<td>WHMCS</td>\n<td>/configuration.php</td>\n</tr>\n<tr>\n<td>WordPress</td>\n<td>/wp-config.php</td>\n</tr>\n<tr>\n<td>X7 Chat</td>\n<td>/config.php</td>\n</tr>\n<tr>\n<td>Xoops</td>\n<td>/mainfile.php</td>\n</tr>\n<tr>\n<td>Zen Cart</td>\n<td>/includes/configure.php or /admin/includes/configure.php</td>\n</tr>\n<tr>\n<td>Zikula</td>\n<td>/config.php</td>\n</tr>\n</tbody>\n</table>\n<style class=\"grvsc-styles\">\n  .grvsc-container {\n    overflow: auto;\n    -webkit-overflow-scrolling: touch;\n    padding-top: 1rem;\n    padding-top: var(--grvsc-padding-top, var(--grvsc-padding-v, 1rem));\n    padding-bottom: 1rem;\n    padding-bottom: var(--grvsc-padding-bottom, var(--grvsc-padding-v, 1rem));\n    border-radius: 8px;\n    border-radius: var(--grvsc-border-radius, 8px);\n    font-feature-settings: normal;\n  }\n  \n  .grvsc-code {\n    display: inline-block;\n    min-width: 100%;\n  }\n  \n  .grvsc-line {\n    display: inline-block;\n    box-sizing: border-box;\n    width: 100%;\n    padding-left: 1.5rem;\n    padding-left: var(--grvsc-padding-left, var(--grvsc-padding-h, 1.5rem));\n    padding-right: 1.5rem;\n    padding-right: var(--grvsc-padding-right, var(--grvsc-padding-h, 1.5rem));\n  }\n  \n  .grvsc-line-highlighted {\n    background-color: var(--grvsc-line-highlighted-background-color, transparent);\n    box-shadow: inset var(--grvsc-line-highlighted-border-width, 4px) 0 0 0 var(--grvsc-line-highlighted-border-color, transparent);\n  }\n  \n  .dark-default-dark {\n    background-color: #1E1E1E;\n    color: #D4D4D4;\n  }\n  .dark-default-dark .mtk11 { color: #DCDCAA; }\n  .dark-default-dark .mtk1 { color: #D4D4D4; }\n  .dark-default-dark .mtk8 { color: #CE9178; }\n  .dark-default-dark .mtk3 { color: #6A9955; }\n  .dark-default-dark .mtk4 { color: #569CD6; }\n  .dark-default-dark .mtk12 { color: #9CDCFE; }\n  .dark-default-dark .mtk15 { color: #C586C0; }\n  .dark-default-dark .mtk7 { color: #B5CEA8; }\n  .dark-default-dark .mtk10 { color: #4EC9B0; }\n</style>","frontmatter":{"title":"How to Get Email Alerts for Unhandled PHP Exceptions","author":{"id":"Team LoginRadius","github":"LoginRadius","avatar":null},"date":"October 26, 2015","updated_date":null,"tags":["PHP","Email"],"coverImage":{"childImageSharp":{"fluid":{"aspectRatio":1,"src":"/static/7cc01786c805c6dabe755c22c0e6b3fb/7fbdd/email-alerts-unhandled-php.webp","srcSet":"/static/7cc01786c805c6dabe755c22c0e6b3fb/61e93/email-alerts-unhandled-php.webp 200w,\n/static/7cc01786c805c6dabe755c22c0e6b3fb/1f5c5/email-alerts-unhandled-php.webp 400w,\n/static/7cc01786c805c6dabe755c22c0e6b3fb/7fbdd/email-alerts-unhandled-php.webp 610w","sizes":"(max-width: 610px) 100vw, 610px"}}}},"fields":{"authorId":"Team LoginRadius","slug":"/engineering/how-to-get-email-alerts-for-unhandled-php-exceptions/"}}},{"node":{"id":"468bf404-4dfb-5ea9-b5e7-8cec7c852a91","html":"<p><strong>Introduction</strong></p>\n<p>Authentication and authorization both are most important things for any system and application. This blog starts with authentication and authorization concepts and after that explains the three default important ways and three custom authentication ways for doing authentication and authorization i.e. windows, forms ,passport, multipass, JWT  and SAML authentication. Plus, in this blog I will explain some fundamental concepts about the different authentication system.</p>\n<p><strong>Authentication and Authorization</strong></p>\n<p>Authentication is the process for checking the identity of a user based on the user’s credentials. Generally, user’s credentials are  in the form of user ID and password, and we check their credentials from database or equivalent alternative, if it exists then user is a valid candidate for next process - authorization.</p>\n<p>Authorization also known as “Permission Control” will come after authentication. Authorization is the process of deciding what kind of resource a user can access based on their identity and checking whether the authenticated user has sufficient rights to access the requested resources. Typically a resource can be an ASP.NET web page, media files (MP4, GIF, JPEG etc), compressed file (ZIP, RAR) etc.</p>\n<p><strong>ASP.NET default authentication Providers</strong></p>\n<p><strong>1. Form Authentication</strong></p>\n<p>Normally, form authentication is based on cookies, the authentication and permission settings are stored in cookies. However, we can also use form authentication without cookies, and in cookie-less form authentication we can use query string for passing user details. Remember, the key concept is always ONLY allow the user with correct credential also enough permission to view certain resources, so we need to capture their information and compare with what we have stored in the database. And no matter what kind of form authentication we use, after we receive the data on server end, we will compare them with the data stored in any storage method/provider. For example, we can store username and password in the web.config file, a JSON file, or a database table.</p>\n<p>Forms authentication flow:</p>\n<ol>\n<li>When a user requests a page for the application, ASP.NET checks session cookie. If the cookie exists and valid, ASP.NET assumes the user is authenticated and processes the request.</li>\n<li>If session cookies does not exists or not valid then it redirect to login form.</li>\n<li>User will enter username and password and if they are valid then he will get authenticated and authorized.</li>\n</ol>\n<p> <strong>2. Passport Authentication</strong></p>\n<p>Passport authentication is a centralized authentication service provided by Microsoft. The .NET Passport single sign-in service. When we use passport authentication then user authentication in your application is managed by Microsoft's passport service. Passport authentication uses encrypted cookies to manage the authentication.</p>\n<p><strong>How Password authentication works</strong> Users do not need to retype their sign-in name and password when moving from site to site. Those .NET Passport–enabled sites will issue a set of encrypted cookies in the .NET Passport central servers' domain to facilitate silent and seamless sign-in across sites. In some cases, sites owners will first redirect their end-users to .NET Passport sign-in and to authenticate upon first viewing of their site. If the users are logged in already, they'll get authenticated by ASP.NET, and if they are not logged in they will get redirected to passport servers (i.e hotmail, Live etc.)  to login first. If user successfully authenticates himself, it will return a token to your website.</p>\n<p><strong>3. Windows Authentication</strong></p>\n<p>We use windows authentication when we are creating a web application for a limited number of users who already have Windows account and this type of authentication is quite useful in an intranet environment. This authentication method uses local users windows account 'credentials' for to validate the user. Dot Net web application generally hosted on IIS(Internet Information Server) so the requests go directly to IIS to provide the authentication process in a Windows-based authentication model.</p>\n<p>The entire responsibility of authentication is done by IIS. It first takes the user’s credentials from the domain login. If this process fails, IIS displays an alert dialog box so the user can enter or re-enter his login information.</p>\n<p>Windows authentication have some advantages and disadvantages:</p>\n<p><strong>Windows authentication Advantage</strong></p>\n<ol>\n<li>Developers need to write less line of code for managing user's authentication.</li>\n<li>Users can use their existing windows accounts for login.</li>\n</ol>\n<p><strong>Windows authentication dis-Advantage</strong></p>\n<ol>\n<li>You can't control windows authentication process.</li>\n<li>Windows authentication only works on Microsoft OS you can't use it on others OS.</li>\n</ol>\n<p> <strong>4. Custom authentication Provider</strong></p>\n<ol>\n<li><strong>Multipass</strong></li>\n</ol>\n<p>Multipass authentication is a single sign on authentication. Suppose you have multiple sites and you want to create a single account for a user on both sites then you can use Single Sign-On. Single Sign-On is authentication system it allow user to share his authentication details with your there site. This allows a seamless experience for your users without forcing them to create a separate account on your second site. A multipass is simply a hash of keys and values, provided as an AES encrypted JSON hash.</p>\n<ol start=\"2\">\n<li><strong>JWT (JSON Web token)</strong></li>\n</ol>\n<p>JWTs represent a set of claims as a JSON object that is encoded in a JWS and/or JWE structure. This JSON object is called “JWT Claims Set”. The JSON object consists of zero or more name/value pairs (or members), where the names are strings and the values are arbitrary JSON values. These members are the claims represented by the JWT.</p>\n<p>Your JWTs can contain any information you want; the user's name, birthdate, email, etc. You do this with claims based authorization. You then just tell your provider to make a JWT with these claims from the claims principle.</p>\n<ol start=\"3\">\n<li><strong>SAML (Security Assertion Markup Language)</strong></li>\n</ol>\n<p>SAML - Security Assertion Markup Language SAML. SAML is developed by the Security Services Technical Committee of \"Organization for the Advancement of Structured Information Standards\" (OASIS). SAML is an XML-based framework for exchanging user authentication. The purpose of SAML is to enable Single Sign-On for web applications across various domains.</p>\n<p>SAML have three components: assertions, protocol, and binding. Assertions are authentication, attribute, and authorization. Authentication assertion validates the user's identity. Attribute assertion contains specific information about the user. And authorization assertion identifies user role and permissions.</p>\n<p>SAML works with multiple protocols including Hypertext Transfer Protocol (HTTP), Simple Mail Transfer Protocol (SMTP), File Transfer Protocol (FTP) and also supports SOAP</p>\n<p><strong>Summary</strong></p>\n<p>Different authentication methods are available, and website’s owner always gets confused about which authentication method they should use, here I have explained some of the popular authentication and authorization methods, hope it made it a little bit clear for you. And I will provide some in-depth details about each type of authentication in my next blog, <strong>happy coding</strong>.</p>\n<style class=\"grvsc-styles\">\n  .grvsc-container {\n    overflow: auto;\n    -webkit-overflow-scrolling: touch;\n    padding-top: 1rem;\n    padding-top: var(--grvsc-padding-top, var(--grvsc-padding-v, 1rem));\n    padding-bottom: 1rem;\n    padding-bottom: var(--grvsc-padding-bottom, var(--grvsc-padding-v, 1rem));\n    border-radius: 8px;\n    border-radius: var(--grvsc-border-radius, 8px);\n    font-feature-settings: normal;\n  }\n  \n  .grvsc-code {\n    display: inline-block;\n    min-width: 100%;\n  }\n  \n  .grvsc-line {\n    display: inline-block;\n    box-sizing: border-box;\n    width: 100%;\n    padding-left: 1.5rem;\n    padding-left: var(--grvsc-padding-left, var(--grvsc-padding-h, 1.5rem));\n    padding-right: 1.5rem;\n    padding-right: var(--grvsc-padding-right, var(--grvsc-padding-h, 1.5rem));\n  }\n  \n  .grvsc-line-highlighted {\n    background-color: var(--grvsc-line-highlighted-background-color, transparent);\n    box-shadow: inset var(--grvsc-line-highlighted-border-width, 4px) 0 0 0 var(--grvsc-line-highlighted-border-color, transparent);\n  }\n  \n</style>","frontmatter":{"title":"Types of Authentication in Asp.Net","author":{"id":"Team LoginRadius","github":"LoginRadius","avatar":null},"date":"October 01, 2015","updated_date":null,"tags":["Engineering","Authentication","Asp.Net","Multipass","JWT","JSON Web Token"],"coverImage":{"childImageSharp":{"fluid":{"aspectRatio":1,"src":"/static/051582b8bfe0e3796cdccd575e275a97/e7487/alternate-authentication-asp-dot-net1-150x150.webp","srcSet":"/static/051582b8bfe0e3796cdccd575e275a97/e7487/alternate-authentication-asp-dot-net1-150x150.webp 150w","sizes":"(max-width: 150px) 100vw, 150px"}}}},"fields":{"authorId":"Team LoginRadius","slug":"/engineering/alternate-authentication-asp/"}}},{"node":{"id":"5515690a-c427-560d-abc5-ad4ca6f12802","html":"<p>Ever wondered how I work? No? Well, too bad, I'm still gonna write about it. Hello and welcome to a blog post dedicated to me. In this episode, I'm going to tell you about the tools I use, the things I do to get design inspiration, and what I do when I get stuck on a project.</p>\n<p>Let's get started!</p>\n<h2 id=\"tools-i-use\" style=\"position:relative;\"><a href=\"#tools-i-use\" aria-label=\"tools i use permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Tools I use</h2>\n<h4 id=\"coffee\" style=\"position:relative;\"><a href=\"#coffee\" aria-label=\"coffee permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Coffee</h4>\n<p>Let's face it, you all know this is the number 1 priority for pretty much everyone you know. Getting my fuel up and over driving my brain... And hope to god I don't break down in the middle of the day.</p>\n<h4 id=\"sublime-text-3\" style=\"position:relative;\"><a href=\"#sublime-text-3\" aria-label=\"sublime text 3 permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Sublime Text 3</h4>\n<p>The Photoshop to my coding skills. Sure, there are other text editors out there but this one really knows what it's doing. I have come to the point where I've installed so many Sublime Packages that I cannot function without them.</p>\n<p>Some of those packages are:</p>\n<ol>\n<li><strong>Emmet</strong> Boy, oh boy, Let me tell you about Emmet. But, it would take a long time to explain what it is, so just go to their <a href=\"http://emmet.io/\">site</a>. It's basically premade snippets for pretty much everything you need.</li>\n<li><strong>SidebarEnhancement</strong>Sublime's sidebar is a little bit underdeveloped. Then again, that's what packages are for, right? This nifty little package ehances your sidebar with more options to choose from like: '<em>Reveal...</em>' (which opens the file folder).</li>\n<li><strong>ColorHighlighter</strong>If you're the kind of person who remembers the hex code for colors, you are one talented individual. Ya see, it's hard to visualize colors using hex code. ColorHighlighter puts a background on those colors for you to easily visualize what kind of color #00427c is (regal blue, btw).</li>\n<li><strong>SFTP</strong>This one is a cool package. It lets you edit, sync, and save on-upload files from any of your sftp or ftp servers. But only if you configure it properly. If you use any preprocessors and you're worried that you have to upload the processed file manually. Worry no more as you can make sftp monitor that file if it has changed and automatically upload it. Pretty neat, huh?</li>\n</ol>\n<p><em>And since we're talking about sublime and packages, <a href=\"/beginners-guide-for-sublime-text/\">check out this nifty blog about sublime text and their packages.</a></em></p>\n<h4 id=\"codekit\" style=\"position:relative;\"><a href=\"#codekit\" aria-label=\"codekit permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Codekit</h4>\n<p>If you don't know what is codekit, you should. It compiles everything from SASS to HAML to Coffeescript. It also auto refresh your browser on every save. It... it just works. Bower is also built-in so you have access to over 6,000 components. Best part? No command line usage. Just drop your project files and go.</p>\n<h2 id=\"what-i-do-to-get-inspired\" style=\"position:relative;\"><a href=\"#what-i-do-to-get-inspired\" aria-label=\"what i do to get inspired permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What I do to get inspired.</h2>\n<p>As a normal human being — and not an extraterrestrial or alien as you tiny humans may call it. I tend to get stuck in a design black hole. It is where every ideas you have is just 1 big blank canvas — or as some artists call it \"modern art\". So what do I do when I don't have any ideas? It's simple really. The first website I go to is <a href=\"http://dribbble.com\">dribbble.com</a>. Dribble used to be an invite-only social network for designers. I think they probably opened their doors to everyone. I'm not really sure. But, I am sure that most of the designers there are still the best of the best. What I really like about it is when some designers show how their designs interact with users. With the help of GIF or <a href=\"https://codepen.io/\">codepen</a>. Speaking of codepen, That's the place I go to if I am in need of some CSS trickery. At some point, I do get inspiration from that place too. If dribbble can't help my —oh so in the dark— brain, I go to Pinterest. Pinterest have their own design category with a bunch of different sub categories from Graphic Design to UI/UX. The best thing about it? It links back to another site with more design inspiration. YAY for Pinterest.</p>\n<h3 id=\"getting-out-of-a-sticky-situation\" style=\"position:relative;\"><a href=\"#getting-out-of-a-sticky-situation\" aria-label=\"getting out of a sticky situation permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Getting out of a sticky situation</h3>\n<p>Now that my brain is full of design food. How do I put it to work? There's this thing called a notebook. If you don't know what that is. It looks like this. <img src=\"/b559259155be5529d3475b1b84e6d837/notebook.webp\" alt=\"notebook\"> This is where I start sketching or wireframing all the things I need before moving on to the digital format. And there you have it. A sneak peek on how I work. I hope that this gave you an idea on how to improve your everyday design life. A word of advice. <em>There are a thousand ways to do 1 thing. If someone told you it can't be done; prove them wrong.</em></p>\n<style class=\"grvsc-styles\">\n  .grvsc-container {\n    overflow: auto;\n    -webkit-overflow-scrolling: touch;\n    padding-top: 1rem;\n    padding-top: var(--grvsc-padding-top, var(--grvsc-padding-v, 1rem));\n    padding-bottom: 1rem;\n    padding-bottom: var(--grvsc-padding-bottom, var(--grvsc-padding-v, 1rem));\n    border-radius: 8px;\n    border-radius: var(--grvsc-border-radius, 8px);\n    font-feature-settings: normal;\n  }\n  \n  .grvsc-code {\n    display: inline-block;\n    min-width: 100%;\n  }\n  \n  .grvsc-line {\n    display: inline-block;\n    box-sizing: border-box;\n    width: 100%;\n    padding-left: 1.5rem;\n    padding-left: var(--grvsc-padding-left, var(--grvsc-padding-h, 1.5rem));\n    padding-right: 1.5rem;\n    padding-right: var(--grvsc-padding-right, var(--grvsc-padding-h, 1.5rem));\n  }\n  \n  .grvsc-line-highlighted {\n    background-color: var(--grvsc-line-highlighted-background-color, transparent);\n    box-shadow: inset var(--grvsc-line-highlighted-border-width, 4px) 0 0 0 var(--grvsc-line-highlighted-border-color, transparent);\n  }\n  \n</style>","frontmatter":{"title":"Hi, My Name is Darryl, and This is How I Work","author":{"id":"Team LoginRadius","github":"LoginRadius","avatar":null},"date":"September 22, 2015","updated_date":null,"tags":["Tools","Engineering"],"coverImage":{"childImageSharp":{"fluid":{"aspectRatio":1,"src":"/static/73f818bb44071a33e66d0518c85bb5ff/403a4/darryl-how-i-work-300x300.webp","srcSet":"/static/73f818bb44071a33e66d0518c85bb5ff/61e93/darryl-how-i-work-300x300.webp 200w,\n/static/73f818bb44071a33e66d0518c85bb5ff/403a4/darryl-how-i-work-300x300.webp 300w","sizes":"(max-width: 300px) 100vw, 300px"}}}},"fields":{"authorId":"Team LoginRadius","slug":"/engineering/my-name-is-darryl-this-is-how-work/"}}},{"node":{"id":"98390f8b-ce67-5801-b91b-62de0aa25c34","html":"<p>Sublime is no doubt the highly preferred light weight editor for developers, it doesn't require major installation space and working with it is just plain fun. The goal of this blog is to help you set-up the basic extensions that are required while working with Sublime: Package Control, a professional, sharp looking theme pack, and a core feature of Sublime, \"Goto Everywhere\". I am using a Mac, but the concept also works well in Windows, check the corresponding shortcut online, and it should be an easy and smooth process.</p>\n<p>Before marching forward, make sure Sublime Text Editor 3 is properly installed, if you haven't installed it yet, you can download it <a href=\"http://www.sublimetext.com/3\">here</a>.</p>\n<h3 id=\"1-package-control\" style=\"position:relative;\"><a href=\"#1-package-control\" aria-label=\"1 package control permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>1. Package Control</h3>\n<p>Still with me? Awesome! Let's get started. First of all, the most amazing thing about Sublime is the diverse collection of packages you can install. The packages vary from big ones such as Git and SublimetoCodeIntel to small handy widgets like color picker and path auto fill. Keep checking and digging for the most useful packages for yourself is a very important part for your daily coding with Sublime. Therefore, first things first, let's install the Package Control.</p>\n<p><a href=\"https://packagecontrol.io/installation\">Installation Guide is here</a></p>\n<p>Press</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"\" data-index=\"0\"><code class=\"grvsc-code\"><span class=\"grvsc-line\">ctrl + `(Normally the one under Esc)</span></code></pre>\n<p>Then paste the code from above link into your console, it could be confusing to paste a big graph of code into your sublime python console, but it does work, so Let's do it.</p>\n<p>Now try pressing</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"\" data-index=\"1\"><code class=\"grvsc-code\"><span class=\"grvsc-line\">Cmd + Shift + p</span></code></pre>\n<p>Then type \"Install Package\", you should see it now:  </p>\n<p><img src=\"/36afd7ed765fbb0034e4ba21d0699603/install-package.webp\" alt=\"install-package\"></p>\n<p>2. Theme</p>\n<p>Prior to installing any functional package, let's make sublime even prettier, let's search for a theme!</p>\n<ol>\n<li>Install Package from above</li>\n<li>Then type \"Theme\"</li>\n</ol>\n<p>You should see a big list of themes right now, you can first search on the internet to have some previews of the themes, pick a good color scheme that you like and then search for it here. What I would suggest is the one I am using it, is called \"Theme - itg.flat\"</p>\n<p>After installing your preferred theme, the font and color scheme for sublime may have already been updated. But it doesn't quiet look like what you have seen from elsewhere does it? It's because you also need to update the UI preferences for sublime, for itg.flat it will give you a more flat look after the update.</p>\n<p>Navigate to:</p>\n<p><img src=\"/3678a3c00fd847b686c00e4495b78304/user-preference.webp\" alt=\"user-preference\"></p>\n<p>What this file does is actually overwrite the settings in the default-setting JSON file, if you mess up with this user file, just delete them to recover back to the original settings. So feel free to play around with it, from here you can define the settings from your theme provider's guidance, here I will post mine as a sample</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"json\" data-index=\"2\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\">{</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">&quot;color_scheme&quot;</span><span class=\"mtk1\">: </span><span class=\"mtk8\">&quot;Packages/Theme - itg.flat/itg.dark.tmTheme&quot;</span><span class=\"mtk1\">,</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">&quot;font_size&quot;</span><span class=\"mtk1\">: </span><span class=\"mtk7\">14</span><span class=\"mtk1\">,</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">&quot;highlight_line&quot;</span><span class=\"mtk1\">: </span><span class=\"mtk4\">true</span><span class=\"mtk1\">,</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">&quot;highlight_modified_tabs&quot;</span><span class=\"mtk1\">: </span><span class=\"mtk4\">true</span><span class=\"mtk1\">,</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">&quot;theme&quot;</span><span class=\"mtk1\">: </span><span class=\"mtk8\">&quot;itg.flat.dark.sublime-theme&quot;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span></code></pre>\n<p>Please note JSON format is significant to Sublime Settings, when you are not sure about it, check it with an online JSON validator. Now with this step done, you will have a delightful working environment to write your code in:  </p>\n<p><img src=\"/41b210161a3945e693da5b05545d457a/sample-code.webp\" alt=\"sample-code\"></p>\n<p>3. Goto Everywhere</p>\n<p>One of the most awesome features provided by sublime is called \"Goto Everywhere\", to me it is more like a \"Find Everything\". Once you get used to it, it will boost your productivity incredibly by saving enormous amount of time on finding stuff. Here is a brief list of its most common usage purpose:</p>\n<ul>\n<li>Quickly navigate to a file</li>\n<li>Quickly jump to a line</li>\n<li>Quickly locate an symbol</li>\n</ul>\n<p>To trigger this feature, press key combination:</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"\" data-index=\"3\"><code class=\"grvsc-code\"><span class=\"grvsc-line\">Cmd + p</span></code></pre>\n<p>Then for different purpose you just press different buttons to trigger the function,</p>\n<ul>\n<li>Goto file: directly type in the file name</li>\n<li>Goto line number: press <code>:</code> then input the number of line you want to jump into</li>\n<li>Goto symbol: press <code>@</code>, then you will see a list of options automatically show up. Navigate through or directly input the symbol you are looking for, this is most commonly used by search for HTML ids and classnames.</li>\n</ul>\n<p>So far I have briefly covered the essential features sublime provides.In the next blog of this series I will explain how to make your work even easier by utilizing sublime Project, Snippet and Macro.\nUntil then, Adios!!!</p>\n<style class=\"grvsc-styles\">\n  .grvsc-container {\n    overflow: auto;\n    -webkit-overflow-scrolling: touch;\n    padding-top: 1rem;\n    padding-top: var(--grvsc-padding-top, var(--grvsc-padding-v, 1rem));\n    padding-bottom: 1rem;\n    padding-bottom: var(--grvsc-padding-bottom, var(--grvsc-padding-v, 1rem));\n    border-radius: 8px;\n    border-radius: var(--grvsc-border-radius, 8px);\n    font-feature-settings: normal;\n  }\n  \n  .grvsc-code {\n    display: inline-block;\n    min-width: 100%;\n  }\n  \n  .grvsc-line {\n    display: inline-block;\n    box-sizing: border-box;\n    width: 100%;\n    padding-left: 1.5rem;\n    padding-left: var(--grvsc-padding-left, var(--grvsc-padding-h, 1.5rem));\n    padding-right: 1.5rem;\n    padding-right: var(--grvsc-padding-right, var(--grvsc-padding-h, 1.5rem));\n  }\n  \n  .grvsc-line-highlighted {\n    background-color: var(--grvsc-line-highlighted-background-color, transparent);\n    box-shadow: inset var(--grvsc-line-highlighted-border-width, 4px) 0 0 0 var(--grvsc-line-highlighted-border-color, transparent);\n  }\n  \n  .dark-default-dark {\n    background-color: #1E1E1E;\n    color: #D4D4D4;\n  }\n  .dark-default-dark .mtk1 { color: #D4D4D4; }\n  .dark-default-dark .mtk12 { color: #9CDCFE; }\n  .dark-default-dark .mtk8 { color: #CE9178; }\n  .dark-default-dark .mtk7 { color: #B5CEA8; }\n  .dark-default-dark .mtk4 { color: #569CD6; }\n</style>","frontmatter":{"title":"Beginner's Guide for Sublime Text 3","author":{"id":"Team LoginRadius","github":"LoginRadius","avatar":null},"date":"September 15, 2015","updated_date":null,"tags":["SublimeText","CodeEditor"],"coverImage":{"childImageSharp":{"fluid":{"aspectRatio":1,"src":"/static/296e569fc8dd1576c6df798847aaf8ad/7fbdd/Beginner-Guide-Sublime-Text.webp","srcSet":"/static/296e569fc8dd1576c6df798847aaf8ad/61e93/Beginner-Guide-Sublime-Text.webp 200w,\n/static/296e569fc8dd1576c6df798847aaf8ad/1f5c5/Beginner-Guide-Sublime-Text.webp 400w,\n/static/296e569fc8dd1576c6df798847aaf8ad/7fbdd/Beginner-Guide-Sublime-Text.webp 610w","sizes":"(max-width: 610px) 100vw, 610px"}}}},"fields":{"authorId":"Team LoginRadius","slug":"/engineering/beginners-guide-for-sublime-text/"}}},{"node":{"id":"0f403a39-e696-56dc-9fe7-35f0cbbff156","html":"<p>I am here to tell you that Facebook, Google, Twitter, or LinkedIn aren’t going to be happy when they find out that you changed their icon color to green. But, hey at least you didn’t distort the logo.</p>\n<p>Hello and welcome to another segment of me telling you things that you need to know but will ignore at some point. Let’s get started.</p>\n<p>Social Login and Social Sharing are everywhere. Some people even combine it with with their User Registration. There’s no surprise that on every website you go to, you’ll see either well designed social icons or just plain ugliness. We can’t blame them, they want their icons to be unique and eye catching.</p>\n<p><img src=\"/fb56011614f4224e2ef4c45c93a08edf/1.webp\" alt=\"1\"><em>Beauty!</em></p>\n<p>But, the universe is full of holes inside an “A” whom sometimes destroy a thing of beauty.</p>\n<p><img src=\"/80fcb505560834197a9f54513c4af0bd/2.webp\" alt=\"2\"><em>Just. Stop!</em></p>\n<p>Then there’s the “I use my own brand color” kind of people.</p>\n<p><img src=\"/81faeb78b4a333f7fb4d9e1de1f812ef/3.webp\" alt=\"3\"></p>\n<p><em>So, what’s happening here? What’s the orange f? Does that stands for forangebook? *badum tsss* I’ll see myself out.</em></p>\n<p>Changing the branding color is a big no no for them. You’ll be surprised how strict those social branding guidelines can be. Yet, we still violate them.</p>\n<p>One thing we need to realize is, we don’t own these icons. The companies still own them. So, for your convenience I searched the interwebs to gather most of the things you need to remember for social network branding guidelines.</p>\n<p>Let’s start with the most used social network, Facebook and their “ f ” logo. They’re pretty straightforward, as long as you don’t modify the “ f ” logo’s design and color, you’re good to go. To simplify this more; don’t make the facebook logo look like it’s been scratched by a chicken and made it bleed too much that it turns red.</p>\n<p><img src=\"/4cc1938d041a582a519a9164609a6129/4.webp\" alt=\"4\"></p>\n<p><em>Quick, somebody call 911!</em></p>\n<p><a href=\"https://about.twitter.com/press/twitter-brand-policy\">Twitter branding</a> is a little bit complicated. Probably because they had multiple drastic changes in their logo design.</p>\n<p> <img src=\"/94d97c64dc8dfecf6a3220980bf84ee7/5.webp\" alt=\"5\"> Nonetheless, it’s simple.</p>\n<ul>\n<li>Don’t use their old logo (because, let’s face it, it’s ugly).</li>\n<li>Don’t use a speech bubble (because that’s so 1995)</li>\n<li>Don’t rotate the logo (because the bird might get dizzy)</li>\n<li>Don’t surround with other birds or creatures (he’s a lonebird)</li>\n<li>And the most obvious one, the color. (Use <strong>#55ACEE</strong>)</li>\n</ul>\n<p>On Google+ (yes “ + “ not “plus“), they prefer that you don’t change or remake their icon. But if you must, you can style it to match your design, as long as you don’t...</p>\n<ul>\n<li>Change the color (Use <strong>#dd4b39</strong>)</li>\n<li>Change the font of the “g” and reposition the “+”</li>\n<li>Reposition the icon (it must be centred)</li>\n</ul>\n<p>If you’re using the icon with the title, You should use “Google” without the plus (word and sign), because… well… that’s redundant.</p>\n<p>LinkedIn is kind of ridiculous with their <a href=\"https://brand.linkedin.com/en-us\">branding guidelines</a>. They still have the same drill with no distorting or changing the color and so forth. But there’s one thing you won’t expect, you cannot change the radius or the box. <img src=\"/13e5f4760a9c17550d227d85a8917ab1/6.webp\" alt=\"6\"> </p>\n<p><em>We’re all going to LinkedIn Jail!</em></p>\n<p>Keep it to a minimal radius, like 2px. That means no circle, square, iOS style rounded icons — hold the phone, did LinkedIn just violate their own branding guidelines? Tsk tsk, LinkedIn. Breaking your own rules, eh?</p>\n<p>What about the other 30+ social icons? Well, by now you’ve probably seen the pattern here. No? Well, let me break it down for you.</p>\n<ul>\n<li>Don’t distort, remake, or change the style of the logo</li>\n<li>Don’t rotate the logo</li>\n<li>Don’t change the color</li>\n<li>Always use the most recent logo</li>\n</ul>\n<p>But, who am I to tell you what to do? Just do what makes you happy and hope to god they don’t catch you. Keep in mind too that these branding guidelines are part of your user experience and affect your users impression of the site.</p>\n<p>Let me know in the comments if there’s a specific guideline that I miss.</p>\n<style class=\"grvsc-styles\">\n  .grvsc-container {\n    overflow: auto;\n    -webkit-overflow-scrolling: touch;\n    padding-top: 1rem;\n    padding-top: var(--grvsc-padding-top, var(--grvsc-padding-v, 1rem));\n    padding-bottom: 1rem;\n    padding-bottom: var(--grvsc-padding-bottom, var(--grvsc-padding-v, 1rem));\n    border-radius: 8px;\n    border-radius: var(--grvsc-border-radius, 8px);\n    font-feature-settings: normal;\n  }\n  \n  .grvsc-code {\n    display: inline-block;\n    min-width: 100%;\n  }\n  \n  .grvsc-line {\n    display: inline-block;\n    box-sizing: border-box;\n    width: 100%;\n    padding-left: 1.5rem;\n    padding-left: var(--grvsc-padding-left, var(--grvsc-padding-h, 1.5rem));\n    padding-right: 1.5rem;\n    padding-right: var(--grvsc-padding-right, var(--grvsc-padding-h, 1.5rem));\n  }\n  \n  .grvsc-line-highlighted {\n    background-color: var(--grvsc-line-highlighted-background-color, transparent);\n    box-shadow: inset var(--grvsc-line-highlighted-border-width, 4px) 0 0 0 var(--grvsc-line-highlighted-border-color, transparent);\n  }\n  \n</style>","frontmatter":{"title":"Social Network Branding Guidelines","author":{"id":"Team LoginRadius","github":"LoginRadius","avatar":null},"date":"September 08, 2015","updated_date":null,"tags":["Social","SocialLogin","Branding"],"coverImage":{"childImageSharp":{"fluid":{"aspectRatio":1,"src":"/static/63460374fc13a4962cd40dfa765485b1/403a4/social-network-branding-300x300.webp","srcSet":"/static/63460374fc13a4962cd40dfa765485b1/61e93/social-network-branding-300x300.webp 200w,\n/static/63460374fc13a4962cd40dfa765485b1/403a4/social-network-branding-300x300.webp 300w","sizes":"(max-width: 300px) 100vw, 300px"}}}},"fields":{"authorId":"Team LoginRadius","slug":"/engineering/social-network-branding-guidelines/"}}},{"node":{"id":"24f32e3d-b37c-518e-b0da-fec43d819be5","html":"<p>Hey there, spider. It’s me again, your amazing blog writer, Darryl. Have you ever wanted to select the second or third child of an element without using CSS3 nth-child —which aren’t working on grandpa browsers. Let’s face it, a lot of human beings are afraid of change that they tend to stick to what they know.</p>\n<p>I’m not a pro “support the older browser” kind of guy because I still think that people won’t upgrade if we keep spoiling them. But for the sake of knowing a workaround I’m gonna teach you how to ab-use sibling selectors for better compatibility.</p>\n<h3 id=\"what-are-sibling-selectors\" style=\"position:relative;\"><a href=\"#what-are-sibling-selectors\" aria-label=\"what are sibling selectors permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What are sibling selectors.</h3>\n<p>Sibling selectors consists of a squiggly line ( ~ ) and a plus sign ( + ).</p>\n<p>Squiggly line selects all the siblings below that element where you use that sign. Plus sign select only the next sibling.</p>\n<h3 id=\"great-give-me-the-deets\" style=\"position:relative;\"><a href=\"#great-give-me-the-deets\" aria-label=\"great give me the deets permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Great, give me the deets.</h3>\n<p><img src=\"/abd7ca3edfcf0936a62d81dd2468015d/lr-home.webp\" alt=\"lr-home\"></p>\n<p>Have you ever seen our <a href=\"https://docs.loginradius.com/\">support docs</a>?  </p>\n<p>Would you believe me if I tell you that from “Getting Started” to the “Social Sharing” section, they are all siblings with the same class and everything… well except for the css code and the search, we’ll get to that later.</p>\n<p>Anyhoo, how did I do it? It’s easy, since I know that the sibling I want to get was the first child. I just used the :first child pseudo element to style the first element.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"css\" data-index=\"0\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk6\">.sibling:first-child</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk3\">/*styles for first sibling*/</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span></code></pre>\n<p>Then again, that’s not a sibling selector, that’s a pseudo element. Calm your feets, this is the part where we ab-use those selectors.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"css\" data-index=\"1\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk6\">.sibling:first-child</span><span class=\"mtk1\"> ~ </span><span class=\"mtk6\">.sibling</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk3\">/*styles for the rest of the sibling*/</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span></code></pre>\n<p>Why would we do this? This is so it doesn’t add the style for the rest of the sibling to the first-child and vice versa. Less CSS to overwrite and eliminates the use of !important.</p>\n<h3 id=\"lets-go-crazy\" style=\"position:relative;\"><a href=\"#lets-go-crazy\" aria-label=\"lets go crazy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Let’s go crazy.</h3>\n<p>How do we get the third child without using :nth-child pseudo element? It’s simple. Get the first child and ab-use your plus sign(+) sibling selector.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"css\" data-index=\"2\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\">&lt;</span><span class=\"mtk6\">div:first-child</span><span class=\"mtk1\"> + </span><span class=\"mtk6\">div</span><span class=\"mtk1\"> + </span><span class=\"mtk6\">div</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk3\">/*styles*/</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span></code></pre>\n<p>The best part is. It’s backwards compatible.</p>\n<p>What about the 12th child? Well, you can just painfully type all those “+ div”.</p>\n<p>Now, why would we do this? To support IE8, which I don’t like supporting but, maybe you do.</p>\n<p>Keep experimenting with this technique and be free from any restrictions of IE8.</p>\n<style class=\"grvsc-styles\">\n  .grvsc-container {\n    overflow: auto;\n    -webkit-overflow-scrolling: touch;\n    padding-top: 1rem;\n    padding-top: var(--grvsc-padding-top, var(--grvsc-padding-v, 1rem));\n    padding-bottom: 1rem;\n    padding-bottom: var(--grvsc-padding-bottom, var(--grvsc-padding-v, 1rem));\n    border-radius: 8px;\n    border-radius: var(--grvsc-border-radius, 8px);\n    font-feature-settings: normal;\n  }\n  \n  .grvsc-code {\n    display: inline-block;\n    min-width: 100%;\n  }\n  \n  .grvsc-line {\n    display: inline-block;\n    box-sizing: border-box;\n    width: 100%;\n    padding-left: 1.5rem;\n    padding-left: var(--grvsc-padding-left, var(--grvsc-padding-h, 1.5rem));\n    padding-right: 1.5rem;\n    padding-right: var(--grvsc-padding-right, var(--grvsc-padding-h, 1.5rem));\n  }\n  \n  .grvsc-line-highlighted {\n    background-color: var(--grvsc-line-highlighted-background-color, transparent);\n    box-shadow: inset var(--grvsc-line-highlighted-border-width, 4px) 0 0 0 var(--grvsc-line-highlighted-border-color, transparent);\n  }\n  \n  .dark-default-dark {\n    background-color: #1E1E1E;\n    color: #D4D4D4;\n  }\n  .dark-default-dark .mtk6 { color: #D7BA7D; }\n  .dark-default-dark .mtk1 { color: #D4D4D4; }\n  .dark-default-dark .mtk3 { color: #6A9955; }\n</style>","frontmatter":{"title":"How to ab-USE CSS2 sibling selectors","author":{"id":"Team LoginRadius","github":"LoginRadius","avatar":null},"date":"August 18, 2015","updated_date":null,"tags":["Engineering","Selector","CSS"],"coverImage":{"childImageSharp":{"fluid":{"aspectRatio":1,"src":"/static/bc4587907a3f51743e5602c5512e6236/7fbdd/sibling-selectors.webp","srcSet":"/static/bc4587907a3f51743e5602c5512e6236/61e93/sibling-selectors.webp 200w,\n/static/bc4587907a3f51743e5602c5512e6236/1f5c5/sibling-selectors.webp 400w,\n/static/bc4587907a3f51743e5602c5512e6236/7fbdd/sibling-selectors.webp 610w","sizes":"(max-width: 610px) 100vw, 610px"}}}},"fields":{"authorId":"Team LoginRadius","slug":"/engineering/ab-use-css2-sibling-selectors/"}}},{"node":{"id":"eafcb8fa-d8f5-535b-9de3-ffdfd367b61d","html":"<p>What’s up, my neighbor? This is your boy, Darryl Tec. I am here to teach you how to create a responsive and awesomely scalable icon using CSS sprites. On top of that, we will also add a fallback for browsers that do not support SVG files.</p>\n<h3 id=\"quick-faq\" style=\"position:relative;\"><a href=\"#quick-faq\" aria-label=\"quick faq permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Quick FAQ.</h3>\n<p>SVG - Stands for Scalable Vector Graphics. In short it scales perfectly and you don’t need to worry about having a pixelated image anymore.</p>\n<p>Sprite - Google said it’s a fairy. This is not a fairy. It’s just a bunch of different icons in 1 image. Use it as background image and shift the positioning to show 1 icon. This saves you a lot of loading time. Because instead of loading, say 10 images, you’re loading just 1.</p>\n<p>CSS - Cascading Style Sheet. If you don’t know what this is, I have bad news for ya.</p>\n<h3 id=\"lets-begin\" style=\"position:relative;\"><a href=\"#lets-begin\" aria-label=\"lets begin permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Let's Begin</h3>\n<p><img src=\"/396a6fac14d2d5aa92551ae4d88a5e46/icons.webp\" alt=\"icons\"></p>\n<p>First things first, we need a sprite image that consists four icons – or more, it’s up to you. Luckily, I have one in my digital pocket.  </p>\n<p>We’re just going to use a normal PNG file at first and change it later. Make sure it has a transparent background.</p>\n<p>Now, let’s make their placeholder. The icons you see above is using a grid of 32px by 32px and it’s lining up vertically. I made it like that so it’s easier to find anything, you’ll see why later.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"js\" data-index=\"0\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\">&lt;/</span><span class=\"mtk12\">pre</span><span class=\"mtk1\">&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk17\">&lt;</span><span class=\"mtk4\">div</span><span class=\"mtk1\"> </span><span class=\"mtk12\">class</span><span class=\"mtk1\">=</span><span class=\"mtk8\">&quot;frame&quot;</span><span class=\"mtk17\">&gt;&lt;/</span><span class=\"mtk4\">div</span><span class=\"mtk17\">&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk17\">&lt;</span><span class=\"mtk4\">pre</span><span class=\"mtk17\">&gt;</span></span></code></pre>\n<p>Now we need to style them.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"css\" data-index=\"1\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk6\">.icon</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">width</span><span class=\"mtk1\">: </span><span class=\"mtk7\">32px</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">height</span><span class=\"mtk1\">: </span><span class=\"mtk7\">32px</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">background</span><span class=\"mtk1\">: </span><span class=\"mtk8\">#eee</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">float</span><span class=\"mtk1\">: </span><span class=\"mtk8\">left</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">background-image</span><span class=\"mtk1\">: </span><span class=\"mtk11\">url</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&quot;[ put your image here ]&quot;</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">background-size</span><span class=\"mtk1\">: </span><span class=\"mtk7\">100%</span><span class=\"mtk1\"> </span><span class=\"mtk8\">auto</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk3\">/*extra fluff*/</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">margin</span><span class=\"mtk1\">: </span><span class=\"mtk7\">10px</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">border-radius</span><span class=\"mtk1\">: </span><span class=\"mtk7\">5px</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span></code></pre>\n<p><strong>Explanation</strong></p>\n<p>Looks simple right? But the one thing that’s very important here is the background-size, which makes our sprite responsive. When you put 100% as the value, it will stretch the image depending on what width and height you have. So, be very careful when putting a value on both X and Y axis, because this will distort the image. To stop it from distorting, you should only put a value on one axis and put the other on ‘auto’ so the image scales proportionally.</p>\n<p>If you look at the image I provided, there’s only one icon on X-axis. That means we can just say 100% on X and auto on Y.</p>\n<p>So, we get background-size: 100% auto.</p>\n<p>Cool, right? No crazy percentage. Your icon should look like this:</p>\n<p><img src=\"/af1887d5ca8c855ac62128b3b7c5cffb/facebook-icon.webp\" alt=\"facebook-icon\"></p>\n<p>It’s time to map those icons properly. Facebook is not a problem because it’s first on the list. But for defaults sake, let’s add a code for it.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"css\" data-index=\"2\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\"> </span><span class=\"mtk6\">.icon.facebook</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">   </span><span class=\"mtk12\">background-position</span><span class=\"mtk1\">: </span><span class=\"mtk7\">0</span><span class=\"mtk1\"> </span><span class=\"mtk7\">0</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">   </span><span class=\"mtk12\">background-color</span><span class=\"mtk1\">: </span><span class=\"mtk8\">#3b5998</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\"> }</span></span></code></pre>\n<p>The positioning of 0 0 will map it to the top left of the element.</p>\n<p><img src=\"/4418d0c0d01a1971865f91b64c9fed43/here-icon.webp\" alt=\"here-icon\"></p>\n<p>For the background-color, you can get almost all of the official social icon colors in hex <a href=\"/social-media-colors-hex/\">here</a>.</p>\n<p>How about the rest? Well, there’s a simple formula for that.</p>\n<h3 id=\"the-raw-css-way\" style=\"position:relative;\"><a href=\"#the-raw-css-way\" aria-label=\"the raw css way permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>The raw CSS way</h3>\n<p>Since we’re making this responsive, we need to use percentage. We need to get the height of the image via percentage. Remember what I said earlier about x and y and scaling proportionally? Since the icons are lined up vertically, we need to get the Y-axis, which is the height. The easy way to do that is to just use 100% and never touch x axis again.</p>\n<p>Now, we have to get the position of the icons. Let’s start by counting the icons starting with 0 (zero).</p>\n<p>0 = Facebook</p>\n<p>1 = Google</p>\n<p>2 = LinkedIn</p>\n<p>3 = Twitter</p>\n<p>Facebook isn’t really a problem because we already know where it is. So, let’s exclude it from the count. That gives us 3 icons. We can now use those numbers to get the icon position.</p>\n<p>imageHeight = 100%<br>\niconCount = 3<br>\niconPosition = [1,  2 or 3]<br>\nWe need to go downwards on the sprite. That means it’s negative.</p>\n<p>-imageHeight / iconCount * iconPosition<br>\n-100% / 3 / 1 = 33.33% is Google’s position<br>\n-100% / 3 / 2 = 66.66% is LinkedIn’s position<br>\n-100% / 3 / 3 = 99.99% is Twitter’s position<br>\nThat gives us this code</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"css\" data-index=\"3\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk6\">.icon.twitter</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">background-position</span><span class=\"mtk1\">: </span><span class=\"mtk7\">0</span><span class=\"mtk1\"> </span><span class=\"mtk7\">-33.33%</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">background-color</span><span class=\"mtk1\">: </span><span class=\"mtk8\">#55acee</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk6\">.icon.linkedin</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">background-position</span><span class=\"mtk1\">: </span><span class=\"mtk7\">0</span><span class=\"mtk1\"> </span><span class=\"mtk7\">-66.66%</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">background-color</span><span class=\"mtk1\">: </span><span class=\"mtk8\">#007bb6</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk6\">.icon.google</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">background-position</span><span class=\"mtk1\">: </span><span class=\"mtk7\">0</span><span class=\"mtk1\"> </span><span class=\"mtk7\">-99.99%</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">background-color</span><span class=\"mtk1\">: </span><span class=\"mtk8\">#F90101</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span></code></pre>\n<h2 id=\"the-stylus-way\" style=\"position:relative;\"><a href=\"#the-stylus-way\" aria-label=\"the stylus way permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>The Stylus way</h2>\n<p>If you use stylus you can just do this:<br>\nCreate the mixin</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"javascript\" data-index=\"4\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk11\">getPos</span><span class=\"mtk1\">(</span><span class=\"mtk12\">imageHeight</span><span class=\"mtk1\">, </span><span class=\"mtk12\">iconCount</span><span class=\"mtk1\">, </span><span class=\"mtk12\">iconPosition</span><span class=\"mtk1\">)</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">imageHeight</span><span class=\"mtk1\"> / </span><span class=\"mtk12\">iconCount</span><span class=\"mtk1\"> * </span><span class=\"mtk12\">iconPosition</span></span></code></pre>\n<p>Then call it.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"javascript\" data-index=\"5\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\">.</span><span class=\"mtk12\">icon</span><span class=\"mtk1\">.</span><span class=\"mtk12\">twitter</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">background</span><span class=\"mtk1\">-</span><span class=\"mtk12\">position</span><span class=\"mtk1\"> </span><span class=\"mtk7\">0</span><span class=\"mtk1\"> </span><span class=\"mtk11\">getPos</span><span class=\"mtk1\">(-</span><span class=\"mtk7\">100</span><span class=\"mtk1\">%, </span><span class=\"mtk7\">3</span><span class=\"mtk1\">, </span><span class=\"mtk7\">1</span><span class=\"mtk1\">)</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">background</span><span class=\"mtk1\">-</span><span class=\"mtk12\">color</span><span class=\"mtk1\"> #55</span><span class=\"mtk12\">acee</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\"> </span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">.</span><span class=\"mtk12\">icon</span><span class=\"mtk1\">.</span><span class=\"mtk12\">linkedin</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">background</span><span class=\"mtk1\">-</span><span class=\"mtk12\">position</span><span class=\"mtk1\"> </span><span class=\"mtk7\">0</span><span class=\"mtk1\"> </span><span class=\"mtk11\">getPos</span><span class=\"mtk1\">(-</span><span class=\"mtk7\">100</span><span class=\"mtk1\">%, </span><span class=\"mtk7\">3</span><span class=\"mtk1\">, </span><span class=\"mtk7\">2</span><span class=\"mtk1\">)</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">background</span><span class=\"mtk1\">-</span><span class=\"mtk12\">color</span><span class=\"mtk1\"> #007</span><span class=\"mtk12\">bb6</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\"> </span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">.</span><span class=\"mtk12\">icon</span><span class=\"mtk1\">.</span><span class=\"mtk12\">google</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">background</span><span class=\"mtk1\">-</span><span class=\"mtk12\">position</span><span class=\"mtk1\"> </span><span class=\"mtk7\">0</span><span class=\"mtk1\"> </span><span class=\"mtk11\">getPos</span><span class=\"mtk1\">(-</span><span class=\"mtk7\">100</span><span class=\"mtk1\">%, </span><span class=\"mtk7\">3</span><span class=\"mtk1\">, </span><span class=\"mtk7\">3</span><span class=\"mtk1\">)</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">background</span><span class=\"mtk1\">-</span><span class=\"mtk12\">color</span><span class=\"mtk1\"> #</span><span class=\"mtk12\">F90101</span></span></code></pre>\n<p>By now your icon should look like this.</p>\n<p><img src=\"/d95ce5167a6a3fd1c07e24eaa853df05/color-icons.webp\" alt=\"color-icons\"></p>\n<p>It’s time to change that PNG background to an SVG background.</p>\n<p>and link it to your background image</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"css\" data-index=\"6\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk6\">.icon</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">width</span><span class=\"mtk1\">: </span><span class=\"mtk7\">32px</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">height</span><span class=\"mtk1\">: </span><span class=\"mtk7\">32px</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">background</span><span class=\"mtk1\">: </span><span class=\"mtk8\">#eee</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">float</span><span class=\"mtk1\">: </span><span class=\"mtk8\">left</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">background-image</span><span class=\"mtk1\">: </span><span class=\"mtk11\">url</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&quot;</span><span class=\"mtk14\">[ put your PNG image here ]”);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">background-image:</span><span class=\"mtk1\"> </span><span class=\"mtk12\">linear-gradient(transparent,</span><span class=\"mtk1\"> </span><span class=\"mtk12\">transparent</span><span class=\"mtk1\">), </span><span class=\"mtk11\">url</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&quot;</span><span class=\"mtk14\">[ &lt;b&gt;put your SVG image here&lt;/b&gt; ]”);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">background-size:</span><span class=\"mtk1\"> </span><span class=\"mtk12\">100%</span><span class=\"mtk1\"> </span><span class=\"mtk12\">auto;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\"> </span></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">/*extra</span><span class=\"mtk1\"> </span><span class=\"mtk12\">fluff*/</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">margin:</span><span class=\"mtk1\"> </span><span class=\"mtk12\">10px;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">border-radius:</span><span class=\"mtk1\"> </span><span class=\"mtk12\">5px;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">}</span></span></code></pre>\n<p>If you’re wondering why we’re adding 2 background images is because not all browsers support SVG file. The linear-gradient(transparent, transparent) tricks the CSS into falling back to the PNG image if it doesn’t support it.</p>\n<p>Now, Rescale your width and height and see the magic of responsive icons.</p>\n<p>Aaaaaand then we’re done. That’s how you create a responsive icon.</p>\n<style class=\"grvsc-styles\">\n  .grvsc-container {\n    overflow: auto;\n    -webkit-overflow-scrolling: touch;\n    padding-top: 1rem;\n    padding-top: var(--grvsc-padding-top, var(--grvsc-padding-v, 1rem));\n    padding-bottom: 1rem;\n    padding-bottom: var(--grvsc-padding-bottom, var(--grvsc-padding-v, 1rem));\n    border-radius: 8px;\n    border-radius: var(--grvsc-border-radius, 8px);\n    font-feature-settings: normal;\n  }\n  \n  .grvsc-code {\n    display: inline-block;\n    min-width: 100%;\n  }\n  \n  .grvsc-line {\n    display: inline-block;\n    box-sizing: border-box;\n    width: 100%;\n    padding-left: 1.5rem;\n    padding-left: var(--grvsc-padding-left, var(--grvsc-padding-h, 1.5rem));\n    padding-right: 1.5rem;\n    padding-right: var(--grvsc-padding-right, var(--grvsc-padding-h, 1.5rem));\n  }\n  \n  .grvsc-line-highlighted {\n    background-color: var(--grvsc-line-highlighted-background-color, transparent);\n    box-shadow: inset var(--grvsc-line-highlighted-border-width, 4px) 0 0 0 var(--grvsc-line-highlighted-border-color, transparent);\n  }\n  \n  .dark-default-dark {\n    background-color: #1E1E1E;\n    color: #D4D4D4;\n  }\n  .dark-default-dark .mtk1 { color: #D4D4D4; }\n  .dark-default-dark .mtk12 { color: #9CDCFE; }\n  .dark-default-dark .mtk17 { color: #808080; }\n  .dark-default-dark .mtk4 { color: #569CD6; }\n  .dark-default-dark .mtk8 { color: #CE9178; }\n  .dark-default-dark .mtk6 { color: #D7BA7D; }\n  .dark-default-dark .mtk7 { color: #B5CEA8; }\n  .dark-default-dark .mtk11 { color: #DCDCAA; }\n  .dark-default-dark .mtk3 { color: #6A9955; }\n  .dark-default-dark .mtk14 { color: #F44747; }\n</style>","frontmatter":{"title":"CSS3 Responsive Icons","author":{"id":"Team LoginRadius","github":"LoginRadius","avatar":null},"date":"July 21, 2015","updated_date":null,"tags":["CSS","Responsive","UI"],"coverImage":{"childImageSharp":{"fluid":{"aspectRatio":1,"src":"/static/8d212eebb7243269b59bd9166d0a4cce/403a4/css3-responsive-icons-300x300.webp","srcSet":"/static/8d212eebb7243269b59bd9166d0a4cce/61e93/css3-responsive-icons-300x300.webp 200w,\n/static/8d212eebb7243269b59bd9166d0a4cce/403a4/css3-responsive-icons-300x300.webp 300w","sizes":"(max-width: 300px) 100vw, 300px"}}}},"fields":{"authorId":"Team LoginRadius","slug":"/engineering/css3-responsive-icons/"}}},{"node":{"id":"ba12ee5e-d927-590d-9ea9-6923ab3dc1f9","html":"<p>HTML 5 is the latest and greatest web technology, although it has some issues in some browsers which don’t have native support for the new HTML5 elements. If you want to support some of the older browsers which may still be in use such as IE8 and lower then you are going to have some trouble using HTML5.</p>\n<p>The problem with IE8 and lower versioned IE browsers is that they were created many years ago while HTML5 is new technology and HTML5 tags were newly invented so legacy browsers do not support them. Microsoft will not release any updates for these browsers because they have released new versions of the IE browser.</p>\n<p>As old IE browsers do not know about these tags then it can’t style them so you will find that in IE8 or lower your websites will be rendered without many styles.</p>\n<h4 id=\"how-to-use-html5-in-ie\" style=\"position:relative;\"><a href=\"#how-to-use-html5-in-ie\" aria-label=\"how to use html5 in ie permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>How to use HTML5 in IE</h4>\n<p>If you want HTML5s new tags to be supported in IE then you need to add some javascript to create the elements:</p>\n<p>Example:</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"js\" data-index=\"0\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk17\">&lt;</span><span class=\"mtk4\">script</span><span class=\"mtk17\">&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    document.createElement(&#39;header&#39;);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    document.createElement(&#39;article&#39;);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    document.createElement(&#39;aside&#39;);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    document.createElement(&#39;footer&#39;);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk17\">&lt;/</span><span class=\"mtk4\">script</span><span class=\"mtk17\">&gt;</span></span></code></pre>\n<p>This is not a very good way, you would need to remember all the tags that you have set and include them on every page of your website. If you add any new tags then you need to add these tags on every page of the website as well. Thankfully Remy Sharp provided a solution for this, Remy Sharp has created a Javascript file which he hosts with google code that will handle this for you.</p>\n<p>add the following at the top of your pages and it will include this code file on your website if the end user is using an IE browser lower than version 9.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"js\" data-index=\"1\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\">&lt;!--[</span><span class=\"mtk12\">if</span><span class=\"mtk1\"> </span><span class=\"mtk12\">lt</span><span class=\"mtk1\"> </span><span class=\"mtk12\">IE</span><span class=\"mtk1\"> </span><span class=\"mtk7\">9</span><span class=\"mtk1\">]&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk17\">&lt;</span><span class=\"mtk4\">script</span><span class=\"mtk1\"> </span><span class=\"mtk12\">src</span><span class=\"mtk1\">=</span><span class=\"mtk8\">&quot;https://html5shim.googlecode.com/svn/trunk/html5.js&quot;</span><span class=\"mtk17\">&gt;&lt;/</span><span class=\"mtk4\">script</span><span class=\"mtk17\">&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">&lt;![</span><span class=\"mtk12\">endif</span><span class=\"mtk1\">]--&gt;</span></span></code></pre>\n<p>IE also does not support some of the most useful new HTML5 methods that are supported by modern browsers:Window.postMessage()</p>\n<p><strong>Window.postMessage</strong></p>\n<p>allows for sending data messages between two windows/frames across domains. Normally, scripts on different pages are allowed to access each other if and only if the pages that executed them are at the same locations with the same protocol (usually both http) and matching host names. The HTML5 postMessage function provides a great way to communicate securely and with high performance and reliability even cross-domain. Unfortunately, the HTML5 postMessage function does not work in IE</p>\n<p>Let’s take a look at how Window.postMessage works:</p>\n<h4 id=\"syntax\" style=\"position:relative;\"><a href=\"#syntax\" aria-label=\"syntax permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Syntax</h4>\n<p>The below signature is used for postMessage:</p>\n<p><strong>otherWindow.postMessage(message, targetOrigin);</strong></p>\n<p><strong>otherWindow</strong>\nA reference to another window; such a reference may be obtained, for example, using the contentWindow property of an iframe element, the object returned by window.open</p>\n<p><strong>message</strong>\nThis parameter is required for a message to be sent to the other window. The message is serialized using the structured clone algorithm. This means you can pass a broad variety of data objects safely to the destination window without having to serialize them yourself.</p>\n<p><strong>targetOrigin</strong>\nWhen the message is dispatched, the current location of the target document is checked. If it does not match the specified URI, then the message will not be dispatched. This parameter can be useful if you want to be sure of the location of the target document before dispatching the message and you can also specify a literal string “*”  (indicating no preference) or as a URI</p>\n<p>but always provide a specific targetOrigin, not *, if you know where the other window’s document should be located. If you do not set a specific location and use “*” then a malicious site can change the location of the window without your knowledge, and therefore it can intercept the data sent using the postMessage method.</p>\n<p><strong>Example for postMessage</strong></p>\n<p><strong>Sender</strong></p>\n<p>The first part of the process is setting up a “source”.  With the source, we will open a new window (or IFrame), send the new window message (in the our example, we’ll do so every 6 seconds, and create an event listener for any response we receive from the destination window.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"javascript\" data-index=\"2\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk3\">//create popup window</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk4\">var</span><span class=\"mtk1\"> </span><span class=\"mtk12\">domain</span><span class=\"mtk1\"> = </span><span class=\"mtk8\">&#39;https://www.example.com&#39;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk4\">var</span><span class=\"mtk1\"> </span><span class=\"mtk12\">myPopup</span><span class=\"mtk1\"> = </span><span class=\"mtk12\">window</span><span class=\"mtk1\">.</span><span class=\"mtk11\">open</span><span class=\"mtk1\">(</span><span class=\"mtk12\">domain</span><span class=\"mtk1\"> + </span><span class=\"mtk8\">&#39;/postmessage.html&#39;</span><span class=\"mtk1\">,</span><span class=\"mtk8\">&#39;myWindow&#39;</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk3\">//periodical message sender</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk11\">setInterval</span><span class=\"mtk1\">(</span><span class=\"mtk4\">function</span><span class=\"mtk1\">(){</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk4\">var</span><span class=\"mtk1\"> </span><span class=\"mtk12\">message</span><span class=\"mtk1\"> = </span><span class=\"mtk8\">&#39;Hello!  The time is: &#39;</span><span class=\"mtk1\"> + (</span><span class=\"mtk4\">new</span><span class=\"mtk1\"> </span><span class=\"mtk10\">Date</span><span class=\"mtk1\">().</span><span class=\"mtk11\">getTime</span><span class=\"mtk1\">());</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">myPopup</span><span class=\"mtk1\">.</span><span class=\"mtk11\">postMessage</span><span class=\"mtk1\">(</span><span class=\"mtk12\">message</span><span class=\"mtk1\">,</span><span class=\"mtk12\">domain</span><span class=\"mtk1\">); </span><span class=\"mtk3\">//send the message and target URI</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">},</span><span class=\"mtk7\">6000</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\"> </span></span>\n<span class=\"grvsc-line\"><span class=\"mtk3\">//listen to back</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\"> </span></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">window</span><span class=\"mtk1\">.</span><span class=\"mtk11\">addEventListener</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&#39;message&#39;</span><span class=\"mtk1\">,</span><span class=\"mtk4\">function</span><span class=\"mtk1\">(</span><span class=\"mtk12\">event</span><span class=\"mtk1\">) {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk15\">if</span><span class=\"mtk1\">(</span><span class=\"mtk12\">event</span><span class=\"mtk1\">.</span><span class=\"mtk12\">origin</span><span class=\"mtk1\"> !== </span><span class=\"mtk8\">&#39;http://scriptandstyle.com&#39;</span><span class=\"mtk1\">) </span><span class=\"mtk15\">return</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk10\">console</span><span class=\"mtk1\">.</span><span class=\"mtk11\">log</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&#39;received response:  &#39;</span><span class=\"mtk1\">,</span><span class=\"mtk12\">event</span><span class=\"mtk1\">.</span><span class=\"mtk12\">data</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">},</span><span class=\"mtk4\">false</span><span class=\"mtk1\">);</span></span></code></pre>\n<p>I have used window.addEventListener which doesn’t work with Internet Explorer so use window.attachEvent</p>\n<p><strong>Receiver</strong></p>\n<p>In the destination window we should validate the message origin and if it is not valid then we will not send the message to the sender, otherwise we send a response back to the sender:</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"javascript\" data-index=\"3\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk12\">window</span><span class=\"mtk1\">.</span><span class=\"mtk11\">addEventListener</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&#39;message&#39;</span><span class=\"mtk1\">,</span><span class=\"mtk4\">function</span><span class=\"mtk1\">(</span><span class=\"mtk12\">event</span><span class=\"mtk1\">) {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk15\">if</span><span class=\"mtk1\">(</span><span class=\"mtk12\">event</span><span class=\"mtk1\">.</span><span class=\"mtk12\">origin</span><span class=\"mtk1\"> !== </span><span class=\"mtk8\">&#39;https://lrblogs.wpengine.com) return</span><span class=\"mtk14\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk12\">event</span><span class=\"mtk1\">.</span><span class=\"mtk12\">source</span><span class=\"mtk1\">.</span><span class=\"mtk11\">postMessage</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&#39;message received:  &#39;</span><span class=\"mtk1\">,</span><span class=\"mtk12\">event</span><span class=\"mtk1\">.</span><span class=\"mtk12\">origin</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">},</span><span class=\"mtk4\">false</span><span class=\"mtk1\">);</span></span></code></pre>\n<p><strong>sessionStorage</strong></p>\n<p>sessionStorage stores data for one session only, this is used in a single transaction it stores the data only for one session and as you close the window the session would be lost and  the data is deleted when the browser is closed.</p>\n<p>HTML5 sessionStorage object are shared in different tabs in the same browser session if you change a sessionStorage attribute’s value in one tab, that change should be reflected within another tab but in IE8 this system will not work properly it does not share sessionStorage objects between frames on a page. This issue has since been fixed in IE11.</p>\n<p><strong>Example:</strong></p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"javascript\" data-index=\"4\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk3\">//save a value</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">sessionStorage</span><span class=\"mtk1\">.</span><span class=\"mtk11\">setItem</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&quot;website&quot;</span><span class=\"mtk1\">, </span><span class=\"mtk8\">&quot;https://www.example.com&quot;</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk3\">//retrieve item</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk4\">var</span><span class=\"mtk1\"> </span><span class=\"mtk12\">website</span><span class=\"mtk1\">= </span><span class=\"mtk12\">sessionStorage</span><span class=\"mtk1\">.</span><span class=\"mtk11\">getItem</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&quot;website&quot;</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk3\">//remove the key</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">sessionStorage</span><span class=\"mtk1\">.</span><span class=\"mtk11\">removeItem</span><span class=\"mtk1\">(“</span><span class=\"mtk12\">website</span><span class=\"mtk1\">”);</span></span></code></pre>\n<p><strong>localStorage</strong></p>\n<p>The localStorage object stores the data like a persistent cookie, with no expiration date. The data will not be deleted when the browser is closed, and will be available when a user returns to the browser.</p>\n<p>IE also supports localStorage from IE8 but it does not support localStorage in IE7 and previous versions.</p>\n<p>localStorage Vs Cookies</p>\n<ol>\n<li>Cookies are small text files stored by browsers allowing for a max of 4KB while with localStorage we can store Mbs of localStorage data.</li>\n<li>Cookies are delivered with every request, which can slow down the delivery of your web pages.</li>\n</ol>\n<p><strong>Example</strong></p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"javascript\" data-index=\"5\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk3\">//save a value</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">localStorage</span><span class=\"mtk1\">.</span><span class=\"mtk11\">setItem</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&quot;Domain&quot;</span><span class=\"mtk1\">, </span><span class=\"mtk8\">&quot;https://www.example.com&quot;</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk3\">//retrieve item</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk4\">var</span><span class=\"mtk1\"> </span><span class=\"mtk12\">website</span><span class=\"mtk1\">= </span><span class=\"mtk12\">localStorage</span><span class=\"mtk1\">.</span><span class=\"mtk11\">getItem</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&quot;website&quot;</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk3\">//remove the key</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">localStorage</span><span class=\"mtk1\">.</span><span class=\"mtk11\">removeItem</span><span class=\"mtk1\">(“</span><span class=\"mtk12\">website</span><span class=\"mtk1\">”);</span></span></code></pre>\n<style class=\"grvsc-styles\">\n  .grvsc-container {\n    overflow: auto;\n    -webkit-overflow-scrolling: touch;\n    padding-top: 1rem;\n    padding-top: var(--grvsc-padding-top, var(--grvsc-padding-v, 1rem));\n    padding-bottom: 1rem;\n    padding-bottom: var(--grvsc-padding-bottom, var(--grvsc-padding-v, 1rem));\n    border-radius: 8px;\n    border-radius: var(--grvsc-border-radius, 8px);\n    font-feature-settings: normal;\n  }\n  \n  .grvsc-code {\n    display: inline-block;\n    min-width: 100%;\n  }\n  \n  .grvsc-line {\n    display: inline-block;\n    box-sizing: border-box;\n    width: 100%;\n    padding-left: 1.5rem;\n    padding-left: var(--grvsc-padding-left, var(--grvsc-padding-h, 1.5rem));\n    padding-right: 1.5rem;\n    padding-right: var(--grvsc-padding-right, var(--grvsc-padding-h, 1.5rem));\n  }\n  \n  .grvsc-line-highlighted {\n    background-color: var(--grvsc-line-highlighted-background-color, transparent);\n    box-shadow: inset var(--grvsc-line-highlighted-border-width, 4px) 0 0 0 var(--grvsc-line-highlighted-border-color, transparent);\n  }\n  \n  .dark-default-dark {\n    background-color: #1E1E1E;\n    color: #D4D4D4;\n  }\n  .dark-default-dark .mtk1 { color: #D4D4D4; }\n  .dark-default-dark .mtk17 { color: #808080; }\n  .dark-default-dark .mtk4 { color: #569CD6; }\n  .dark-default-dark .mtk12 { color: #9CDCFE; }\n  .dark-default-dark .mtk7 { color: #B5CEA8; }\n  .dark-default-dark .mtk8 { color: #CE9178; }\n  .dark-default-dark .mtk3 { color: #6A9955; }\n  .dark-default-dark .mtk11 { color: #DCDCAA; }\n  .dark-default-dark .mtk10 { color: #4EC9B0; }\n  .dark-default-dark .mtk15 { color: #C586C0; }\n  .dark-default-dark .mtk14 { color: #F44747; }\n</style>","frontmatter":{"title":"HTML5 Limitation in Internet Explorer","author":{"id":"Team LoginRadius","github":"LoginRadius","avatar":null},"date":"June 30, 2015","updated_date":null,"tags":["Java","Maven","Eclipse"],"coverImage":{"childImageSharp":{"fluid":{"aspectRatio":1,"src":"/static/20127eac7a49d6d333dd2483a84b5c4c/7fbdd/radio-check-buttons-css.webp","srcSet":"/static/20127eac7a49d6d333dd2483a84b5c4c/61e93/radio-check-buttons-css.webp 200w,\n/static/20127eac7a49d6d333dd2483a84b5c4c/1f5c5/radio-check-buttons-css.webp 400w,\n/static/20127eac7a49d6d333dd2483a84b5c4c/7fbdd/radio-check-buttons-css.webp 610w","sizes":"(max-width: 610px) 100vw, 610px"}}}},"fields":{"authorId":"Team LoginRadius","slug":"/engineering/html5-limitation-in-internet-explorer/"}}},{"node":{"id":"f4a40024-106d-5f62-9e60-11de7ef9cbc5","html":"<p>Let's face it, at some point you look at a radio or a checkbox button and you're like... this looks like something that starts with an \"s\" and ends with a \"hit\". I'm here to stop you from saying that word and go on with your life without worrying about those ugly things.</p>\n<p>We're just going to use code here. No images, just pure scalable user interface using code. Cool, eh? Let's get started.</p>\n<p>Let's create our code structure first.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"js\" data-index=\"0\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\">&lt;!-- </span><span class=\"mtk12\">Radio</span><span class=\"mtk1\"> --&gt; </span></span>\n<span class=\"grvsc-line\"><span class=\"mtk17\">&lt;</span><span class=\"mtk4\">label</span><span class=\"mtk17\">&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk17\">&lt;</span><span class=\"mtk4\">input</span><span class=\"mtk1\"> </span><span class=\"mtk12\">type</span><span class=\"mtk1\">=</span><span class=\"mtk8\">&quot;radio&quot;</span><span class=\"mtk17\">&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk17\">&lt;</span><span class=\"mtk4\">span</span><span class=\"mtk17\">&gt;</span><span class=\"mtk1\">I&#39;m a radio button</span><span class=\"mtk17\">&lt;/</span><span class=\"mtk4\">span</span><span class=\"mtk17\">&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk17\">&lt;/</span><span class=\"mtk4\">label</span><span class=\"mtk17\">&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">&lt;!-- Checkbox --&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk17\">&lt;</span><span class=\"mtk4\">label</span><span class=\"mtk17\">&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk17\">&lt;</span><span class=\"mtk4\">input</span><span class=\"mtk1\"> </span><span class=\"mtk12\">type</span><span class=\"mtk1\">=</span><span class=\"mtk8\">&quot;checkbox&quot;</span><span class=\"mtk17\">&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk17\">&lt;</span><span class=\"mtk4\">span</span><span class=\"mtk17\">&gt;</span><span class=\"mtk1\">I&#39;m a checkbox</span><span class=\"mtk17\">&lt;/</span><span class=\"mtk4\">span</span><span class=\"mtk17\">&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk17\">&lt;/</span><span class=\"mtk4\">label</span><span class=\"mtk17\">&gt;</span></span></code></pre>\n<p>If it looks ugly, don't be alarmed. That's normal for an untamed code from the wild. All you gotta do now is to tame it with our very best tool, CSS.</p>\n<p>First thing you have to do is to hide the element that generates the hideous button, which is... DUN DUN DUN... the input tag. Don't worry, we can still trigger it even though it's hidden. How? by nesting it inside the label tag.</p>\n<p>Now that the default toggles are gone, we need to create our fake —but amazing— toggles.</p>\n<p><strong>Radio Button</strong></p>\n<p>We can't really customize this toggle that much because it needs other toggles to work properly. Let's just prettify it a bit.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"css\" data-index=\"1\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk6\">label</span><span class=\"mtk1\"> </span><span class=\"mtk6\">input</span><span class=\"mtk1\">[</span><span class=\"mtk12\">type</span><span class=\"mtk1\">=</span><span class=\"mtk8\">&quot;radio&quot;</span><span class=\"mtk1\">] {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">display</span><span class=\"mtk1\">: </span><span class=\"mtk8\">none</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk6\">label</span><span class=\"mtk1\"> </span><span class=\"mtk6\">input</span><span class=\"mtk1\">[</span><span class=\"mtk12\">type</span><span class=\"mtk1\">=</span><span class=\"mtk8\">&quot;radio&quot;</span><span class=\"mtk1\">] ~ </span><span class=\"mtk6\">span</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">position</span><span class=\"mtk1\">: </span><span class=\"mtk8\">relative</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">display</span><span class=\"mtk1\">: </span><span class=\"mtk8\">inline-block</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">padding</span><span class=\"mtk1\">: </span><span class=\"mtk7\">3px</span><span class=\"mtk1\"> </span><span class=\"mtk7\">0</span><span class=\"mtk1\"> </span><span class=\"mtk7\">3px</span><span class=\"mtk1\"> </span><span class=\"mtk7\">25px</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk6\">label</span><span class=\"mtk1\"> </span><span class=\"mtk6\">input</span><span class=\"mtk1\">[</span><span class=\"mtk12\">type</span><span class=\"mtk1\">=</span><span class=\"mtk8\">&quot;radio&quot;</span><span class=\"mtk1\">] ~ </span><span class=\"mtk6\">span:before</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">content</span><span class=\"mtk1\">: </span><span class=\"mtk8\">&quot;&quot;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">position</span><span class=\"mtk1\">: </span><span class=\"mtk8\">absolute</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">display</span><span class=\"mtk1\">: </span><span class=\"mtk8\">block</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">width</span><span class=\"mtk1\">: </span><span class=\"mtk7\">18px</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">height</span><span class=\"mtk1\">: </span><span class=\"mtk7\">18px</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">background</span><span class=\"mtk1\">: </span><span class=\"mtk8\">#fff</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">margin-right</span><span class=\"mtk1\">: </span><span class=\"mtk7\">5px</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">border</span><span class=\"mtk1\">: </span><span class=\"mtk7\">1px</span><span class=\"mtk1\"> </span><span class=\"mtk8\">solid</span><span class=\"mtk1\"> </span><span class=\"mtk8\">#ccc</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">border-radius</span><span class=\"mtk1\">: </span><span class=\"mtk7\">50%</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">left</span><span class=\"mtk1\">: </span><span class=\"mtk7\">0</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">top</span><span class=\"mtk1\">: </span><span class=\"mtk7\">0</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">box-sizing</span><span class=\"mtk1\">: </span><span class=\"mtk8\">border-box</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">transition</span><span class=\"mtk1\">: </span><span class=\"mtk8\">all</span><span class=\"mtk1\"> </span><span class=\"mtk7\">300ms</span><span class=\"mtk1\"> </span><span class=\"mtk8\">ease-in-out</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk6\">label</span><span class=\"mtk1\"> </span><span class=\"mtk6\">input</span><span class=\"mtk1\">[</span><span class=\"mtk12\">type</span><span class=\"mtk1\">=</span><span class=\"mtk8\">&quot;radio&quot;</span><span class=\"mtk1\">]</span><span class=\"mtk6\">:checked</span><span class=\"mtk1\"> ~ </span><span class=\"mtk6\">span:before</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">border</span><span class=\"mtk1\">: </span><span class=\"mtk7\">5px</span><span class=\"mtk1\"> </span><span class=\"mtk8\">solid</span><span class=\"mtk1\"> </span><span class=\"mtk8\">#29d</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span></code></pre>\n<p><img src=\"/d36cc3d6f3b8656bc3c213dd8d697e8b/checked-radio.webp\" alt=\"checked-radio\"></p>\n<p><img src=\"/0d8bd0a9dd2fb37571012a6c7fca93aa/unchecked-radio.webp\" alt=\"unchecked-radio\"></p>\n<p>By now it should like this.  </p>\n<p>Cleaner toggles!</p>\n<p><strong>Checkbox</strong></p>\n<p>This one is fun to customize because it has an on and off feature or a switch. Let's start with a simple toggle. We're going to transform this hideous toggle (screenshot) to this beautiful creature (screenshot).</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"css\" data-index=\"2\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk6\">label.spin</span><span class=\"mtk1\"> </span><span class=\"mtk6\">input</span><span class=\"mtk1\">[</span><span class=\"mtk12\">type</span><span class=\"mtk1\">=</span><span class=\"mtk8\">&quot;checkbox&quot;</span><span class=\"mtk1\">] {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">display</span><span class=\"mtk1\">: </span><span class=\"mtk8\">none</span><span class=\"mtk1\">; </span><span class=\"mtk3\">/*hides ugly toggle*/</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk6\">label.spin</span><span class=\"mtk1\"> </span><span class=\"mtk6\">input</span><span class=\"mtk1\">[</span><span class=\"mtk12\">type</span><span class=\"mtk1\">=</span><span class=\"mtk8\">&quot;checkbox&quot;</span><span class=\"mtk1\">] ~ </span><span class=\"mtk6\">span</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">position</span><span class=\"mtk1\">: </span><span class=\"mtk8\">relative</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">display</span><span class=\"mtk1\">: </span><span class=\"mtk8\">inline-block</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">padding</span><span class=\"mtk1\">: </span><span class=\"mtk7\">3px</span><span class=\"mtk1\"> </span><span class=\"mtk7\">0</span><span class=\"mtk1\"> </span><span class=\"mtk7\">3px</span><span class=\"mtk1\"> </span><span class=\"mtk7\">25px</span><span class=\"mtk1\">; </span><span class=\"mtk3\">/*adds spacing on the left*/</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk3\">/*create our new toggle*/</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk6\">label.spin</span><span class=\"mtk1\"> </span><span class=\"mtk6\">input</span><span class=\"mtk1\">[</span><span class=\"mtk12\">type</span><span class=\"mtk1\">=</span><span class=\"mtk8\">&quot;checkbox&quot;</span><span class=\"mtk1\">] ~ </span><span class=\"mtk6\">span:before</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">content</span><span class=\"mtk1\">: </span><span class=\"mtk8\">&quot;</span><span class=\"mtk6\">\\2713</span><span class=\"mtk8\">&quot;</span><span class=\"mtk1\">; </span><span class=\"mtk3\">/*add a new check mark*/</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">text-align</span><span class=\"mtk1\">: </span><span class=\"mtk8\">center</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">font-size</span><span class=\"mtk1\">: </span><span class=\"mtk7\">13px</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">position</span><span class=\"mtk1\">: </span><span class=\"mtk8\">absolute</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">display</span><span class=\"mtk1\">: </span><span class=\"mtk8\">block</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">width</span><span class=\"mtk1\">: </span><span class=\"mtk7\">18px</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">height</span><span class=\"mtk1\">: </span><span class=\"mtk7\">18px</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">background</span><span class=\"mtk1\">: </span><span class=\"mtk8\">#fff</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">color</span><span class=\"mtk1\">: </span><span class=\"mtk8\">#fff</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">margin-right</span><span class=\"mtk1\">: </span><span class=\"mtk7\">5px</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">border</span><span class=\"mtk1\">: </span><span class=\"mtk7\">1px</span><span class=\"mtk1\"> </span><span class=\"mtk8\">solid</span><span class=\"mtk1\"> </span><span class=\"mtk8\">#ccc</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">border-radius</span><span class=\"mtk1\">: </span><span class=\"mtk7\">50%</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">left</span><span class=\"mtk1\">: </span><span class=\"mtk7\">0</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">top</span><span class=\"mtk1\">: </span><span class=\"mtk7\">0</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">box-sizing</span><span class=\"mtk1\">: </span><span class=\"mtk8\">border-box</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">transition</span><span class=\"mtk1\">: </span><span class=\"mtk8\">all</span><span class=\"mtk1\"> </span><span class=\"mtk7\">500ms</span><span class=\"mtk1\"> </span><span class=\"mtk8\">ease-in-out</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk3\">/*if checked do this*/</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk6\">label.spin</span><span class=\"mtk1\"> </span><span class=\"mtk6\">input</span><span class=\"mtk1\">[</span><span class=\"mtk12\">type</span><span class=\"mtk1\">=</span><span class=\"mtk8\">&quot;checkbox&quot;</span><span class=\"mtk1\">]</span><span class=\"mtk6\">:checked</span><span class=\"mtk1\"> ~ </span><span class=\"mtk6\">span:before</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">transform</span><span class=\"mtk1\">: </span><span class=\"mtk11\">rotatez</span><span class=\"mtk1\">(</span><span class=\"mtk7\">360deg</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">background</span><span class=\"mtk1\">: </span><span class=\"mtk8\">#29d</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">border-color</span><span class=\"mtk1\">: </span><span class=\"mtk8\">#29d</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span></code></pre>\n<p>Oh yes! Beautiful toggle.</p>\n<p><img src=\"/3607cca80217d22bad9c57e44caf3756/checked-check.webp\" alt=\"checked-check\"></p>\n<p><img src=\"/84a77f006447163b34d99200a668ffc1/unchecked-checkbox.webp\" alt=\"unchecked-checkbox\"></p>\n<p><strong>Bonus!</strong></p>\n<p>Have you ever seen those toggles where it slides to the left and right when you click it? Did you know you can do that too using CSS? Let's try it.</p>\n<p>First, we're going to design the default look of an unchecked checkbox. By now you know that we need to hide the default toggle.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"css\" data-index=\"3\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk6\">label</span><span class=\"mtk1\"> </span><span class=\"mtk6\">input</span><span class=\"mtk1\">[</span><span class=\"mtk12\">type</span><span class=\"mtk1\">=</span><span class=\"mtk8\">&quot;checkbox&quot;</span><span class=\"mtk1\">] { </span><span class=\"mtk12\">display</span><span class=\"mtk1\">: </span><span class=\"mtk8\">none</span><span class=\"mtk1\">; }</span></span></code></pre>\n<p>And then add a space on the left of the span using padding. While you're there, add a position relative to because we need to contain the rest of the elements inside the span.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"css\" data-index=\"4\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk6\">label</span><span class=\"mtk1\"> </span><span class=\"mtk6\">input</span><span class=\"mtk1\">[</span><span class=\"mtk12\">type</span><span class=\"mtk1\">=</span><span class=\"mtk8\">&quot;checkbox&quot;</span><span class=\"mtk1\">] ~ </span><span class=\"mtk6\">span</span><span class=\"mtk1\"> { </span><span class=\"mtk12\">position</span><span class=\"mtk1\">: </span><span class=\"mtk8\">relative</span><span class=\"mtk1\">; </span><span class=\"mtk12\">display</span><span class=\"mtk1\">: </span><span class=\"mtk8\">inline-block</span><span class=\"mtk1\">; </span><span class=\"mtk12\">padding</span><span class=\"mtk1\">: </span><span class=\"mtk7\">3px</span><span class=\"mtk1\"> </span><span class=\"mtk7\">0</span><span class=\"mtk1\"> </span><span class=\"mtk7\">3px</span><span class=\"mtk1\"> </span><span class=\"mtk7\">35px</span><span class=\"mtk1\">; }</span></span></code></pre>\n<p>Now, let's create our toggles using CSS pseudo element :before and :after. Why? Because generated CSS is easier to handle.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"css\" data-index=\"5\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk6\">label</span><span class=\"mtk1\"> </span><span class=\"mtk6\">input</span><span class=\"mtk1\">[</span><span class=\"mtk12\">type</span><span class=\"mtk1\">=</span><span class=\"mtk8\">&quot;checkbox&quot;</span><span class=\"mtk1\">] ~ </span><span class=\"mtk6\">span:before</span><span class=\"mtk1\">, </span><span class=\"mtk6\">label.slide</span><span class=\"mtk1\"> </span><span class=\"mtk6\">input</span><span class=\"mtk1\">[</span><span class=\"mtk12\">type</span><span class=\"mtk1\">=</span><span class=\"mtk8\">&quot;checkbox&quot;</span><span class=\"mtk1\">] ~ </span><span class=\"mtk6\">span:after</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">content</span><span class=\"mtk1\">: </span><span class=\"mtk8\">&quot;&quot;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">position</span><span class=\"mtk1\">: </span><span class=\"mtk8\">absolute</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">display</span><span class=\"mtk1\">: </span><span class=\"mtk8\">block</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">width</span><span class=\"mtk1\">: </span><span class=\"mtk7\">18px</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">height</span><span class=\"mtk1\">: </span><span class=\"mtk7\">18px</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">background</span><span class=\"mtk1\">: </span><span class=\"mtk8\">#fff</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">margin-right</span><span class=\"mtk1\">: </span><span class=\"mtk7\">5px</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">border</span><span class=\"mtk1\">: </span><span class=\"mtk7\">1px</span><span class=\"mtk1\"> </span><span class=\"mtk8\">solid</span><span class=\"mtk1\"> </span><span class=\"mtk8\">#ccc</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">left</span><span class=\"mtk1\">: </span><span class=\"mtk7\">0</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">top</span><span class=\"mtk1\">: </span><span class=\"mtk7\">0</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">box-sizing</span><span class=\"mtk1\">: </span><span class=\"mtk8\">border-box</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">transition</span><span class=\"mtk1\">: </span><span class=\"mtk8\">all</span><span class=\"mtk1\"> </span><span class=\"mtk7\">300ms</span><span class=\"mtk1\"> </span><span class=\"mtk8\">ease-in-out</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span></code></pre>\n<p>This will generate a box looking element. Since it's targeting both pseudo elements, they will look identical and on top of each other.</p>\n<p>It's time to start prettifying those pseudo elements.</p>\n<p>For :after, since this is the background where the :before toggle slides through. We need to modify the width to look bigger. Add an inset shadow to make it look like it's pushed through and a red background for an \"off\" effect.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"css\" data-index=\"6\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk6\">label</span><span class=\"mtk1\"> </span><span class=\"mtk6\">input</span><span class=\"mtk1\">[</span><span class=\"mtk12\">type</span><span class=\"mtk1\">=</span><span class=\"mtk8\">&quot;checkbox&quot;</span><span class=\"mtk1\">] ~ </span><span class=\"mtk6\">span:before</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">width</span><span class=\"mtk1\">: </span><span class=\"mtk7\">30px</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">border-radius</span><span class=\"mtk1\">: </span><span class=\"mtk7\">20px</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">box-shadow</span><span class=\"mtk1\">: </span><span class=\"mtk8\">inset</span><span class=\"mtk1\"> </span><span class=\"mtk7\">0</span><span class=\"mtk1\"> </span><span class=\"mtk7\">2px</span><span class=\"mtk1\"> </span><span class=\"mtk7\">5px</span><span class=\"mtk1\"> </span><span class=\"mtk7\">-1px</span><span class=\"mtk1\"> </span><span class=\"mtk11\">rgba</span><span class=\"mtk1\">(</span><span class=\"mtk7\">0</span><span class=\"mtk1\">, </span><span class=\"mtk7\">0</span><span class=\"mtk1\">, </span><span class=\"mtk7\">0</span><span class=\"mtk1\">, </span><span class=\"mtk7\">0.4</span><span class=\"mtk1\">), </span><span class=\"mtk8\">inset</span><span class=\"mtk1\"> </span><span class=\"mtk7\">0</span><span class=\"mtk1\"> </span><span class=\"mtk7\">-2px</span><span class=\"mtk1\"> </span><span class=\"mtk7\">0</span><span class=\"mtk1\"> </span><span class=\"mtk7\">-1px</span><span class=\"mtk1\"> </span><span class=\"mtk11\">rgba</span><span class=\"mtk1\">(</span><span class=\"mtk7\">255</span><span class=\"mtk1\">, </span><span class=\"mtk7\">255</span><span class=\"mtk1\">, </span><span class=\"mtk7\">255</span><span class=\"mtk1\">, </span><span class=\"mtk7\">0.2</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">background</span><span class=\"mtk1\">: </span><span class=\"mtk8\">#F22613</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span></code></pre>\n<p>For :before, we just need to make it look like a circle and lift it off a bit using box-shadow.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"css\" data-index=\"7\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk6\">label.slide</span><span class=\"mtk1\"> </span><span class=\"mtk6\">input</span><span class=\"mtk1\">[</span><span class=\"mtk12\">type</span><span class=\"mtk1\">=</span><span class=\"mtk8\">&quot;checkbox&quot;</span><span class=\"mtk1\">] ~ </span><span class=\"mtk6\">span:after</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">box-shadow</span><span class=\"mtk1\">: </span><span class=\"mtk7\">0</span><span class=\"mtk1\"> </span><span class=\"mtk7\">3px</span><span class=\"mtk1\"> </span><span class=\"mtk7\">4px</span><span class=\"mtk1\"> </span><span class=\"mtk7\">-2px</span><span class=\"mtk1\"> </span><span class=\"mtk11\">rgba</span><span class=\"mtk1\">(</span><span class=\"mtk7\">0</span><span class=\"mtk1\">, </span><span class=\"mtk7\">0</span><span class=\"mtk1\">, </span><span class=\"mtk7\">0</span><span class=\"mtk1\">, </span><span class=\"mtk7\">0.5</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">border-radius</span><span class=\"mtk1\">: </span><span class=\"mtk7\">50%</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span></code></pre>\n<p>The \"on\" part just needs a little bit of pushing to the side and changing the background to blue or green.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"css\" data-index=\"8\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk6\">label.slide</span><span class=\"mtk1\"> </span><span class=\"mtk6\">input</span><span class=\"mtk1\">[</span><span class=\"mtk12\">type</span><span class=\"mtk1\">=</span><span class=\"mtk8\">&quot;checkbox&quot;</span><span class=\"mtk1\">]</span><span class=\"mtk6\">:checked</span><span class=\"mtk1\"> ~ </span><span class=\"mtk6\">span:before</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">background</span><span class=\"mtk1\">: </span><span class=\"mtk8\">#29d</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk6\">label.slide</span><span class=\"mtk1\"> </span><span class=\"mtk6\">input</span><span class=\"mtk1\">[</span><span class=\"mtk12\">type</span><span class=\"mtk1\">=</span><span class=\"mtk8\">&quot;checkbox&quot;</span><span class=\"mtk1\">]</span><span class=\"mtk6\">:checked</span><span class=\"mtk1\"> ~ </span><span class=\"mtk6\">span:after</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">left</span><span class=\"mtk1\">: </span><span class=\"mtk7\">13px</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span></code></pre>\n<p>The CSS is a bit longer here because there's a lot of elements that need to change, but take a chill pill because CSS won't slow your page down.</p>\n<p>And that's it. Your pretty checkbox or radio button toggles.</p>\n<style class=\"grvsc-styles\">\n  .grvsc-container {\n    overflow: auto;\n    -webkit-overflow-scrolling: touch;\n    padding-top: 1rem;\n    padding-top: var(--grvsc-padding-top, var(--grvsc-padding-v, 1rem));\n    padding-bottom: 1rem;\n    padding-bottom: var(--grvsc-padding-bottom, var(--grvsc-padding-v, 1rem));\n    border-radius: 8px;\n    border-radius: var(--grvsc-border-radius, 8px);\n    font-feature-settings: normal;\n  }\n  \n  .grvsc-code {\n    display: inline-block;\n    min-width: 100%;\n  }\n  \n  .grvsc-line {\n    display: inline-block;\n    box-sizing: border-box;\n    width: 100%;\n    padding-left: 1.5rem;\n    padding-left: var(--grvsc-padding-left, var(--grvsc-padding-h, 1.5rem));\n    padding-right: 1.5rem;\n    padding-right: var(--grvsc-padding-right, var(--grvsc-padding-h, 1.5rem));\n  }\n  \n  .grvsc-line-highlighted {\n    background-color: var(--grvsc-line-highlighted-background-color, transparent);\n    box-shadow: inset var(--grvsc-line-highlighted-border-width, 4px) 0 0 0 var(--grvsc-line-highlighted-border-color, transparent);\n  }\n  \n  .dark-default-dark {\n    background-color: #1E1E1E;\n    color: #D4D4D4;\n  }\n  .dark-default-dark .mtk1 { color: #D4D4D4; }\n  .dark-default-dark .mtk12 { color: #9CDCFE; }\n  .dark-default-dark .mtk17 { color: #808080; }\n  .dark-default-dark .mtk4 { color: #569CD6; }\n  .dark-default-dark .mtk8 { color: #CE9178; }\n  .dark-default-dark .mtk6 { color: #D7BA7D; }\n  .dark-default-dark .mtk7 { color: #B5CEA8; }\n  .dark-default-dark .mtk3 { color: #6A9955; }\n  .dark-default-dark .mtk11 { color: #DCDCAA; }\n</style>","frontmatter":{"title":"Styling Radio and Check buttons with CSS","author":{"id":"Team LoginRadius","github":"LoginRadius","avatar":null},"date":"June 16, 2015","updated_date":null,"tags":["CSS"],"coverImage":{"childImageSharp":{"fluid":{"aspectRatio":1,"src":"/static/20127eac7a49d6d333dd2483a84b5c4c/7fbdd/radio-check-buttons-css-1.webp","srcSet":"/static/20127eac7a49d6d333dd2483a84b5c4c/61e93/radio-check-buttons-css-1.webp 200w,\n/static/20127eac7a49d6d333dd2483a84b5c4c/1f5c5/radio-check-buttons-css-1.webp 400w,\n/static/20127eac7a49d6d333dd2483a84b5c4c/7fbdd/radio-check-buttons-css-1.webp 610w","sizes":"(max-width: 610px) 100vw, 610px"}}}},"fields":{"authorId":"Team LoginRadius","slug":"/engineering/styling-radio-and-check-buttons-with-css/"}}},{"node":{"id":"ac7b1794-ff80-5392-b292-fa0406aef758","html":"<p>Hey there, yogi bear. Tired of creating gifs? Seriously, that takes time and most of the time it has a huge file size and a crappy resolution. What if you can create a gif(ish) element out of CSS? Because you can.</p>\n<p>CSS has come a long way we can now create our own GIF-ish contents and the best part, we have full control over it.</p>\n<p><img src=\"/c26360b02b3fe566935aabf93fa63acd/yeah-css.webp\" alt=\"yeah-css\"></p>\n<p><strong>Great, how do I do it?</strong></p>\n<p>First things first, we need our html structure that will hold all the things we need. There's the container:</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"js\" data-index=\"0\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk17\">&lt;</span><span class=\"mtk4\">div</span><span class=\"mtk1\"> </span><span class=\"mtk12\">class</span><span class=\"mtk1\">=</span><span class=\"mtk8\">&quot;container&quot;</span><span class=\"mtk17\">&gt;</span><span class=\"mtk1\"> &lt;!--There&#39;s the container that centers it--&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk17\">&lt;</span><span class=\"mtk4\">div</span><span class=\"mtk1\"> </span><span class=\"mtk12\">class</span><span class=\"mtk1\">=</span><span class=\"mtk8\">&quot;spinner-frame&quot;</span><span class=\"mtk17\">&gt;</span><span class=\"mtk1\"> &lt;!--The background--&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk17\">&lt;</span><span class=\"mtk4\">div</span><span class=\"mtk1\"> </span><span class=\"mtk12\">class</span><span class=\"mtk1\">=</span><span class=\"mtk8\">&quot;spinner-cover&quot;</span><span class=\"mtk17\">&gt;&lt;/</span><span class=\"mtk4\">div</span><span class=\"mtk17\">&gt;</span><span class=\"mtk1\"> &lt;!--The Foreground--&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk17\">&lt;</span><span class=\"mtk4\">div</span><span class=\"mtk1\"> </span><span class=\"mtk12\">class</span><span class=\"mtk1\">=</span><span class=\"mtk8\">&quot;spinner-bar&quot;</span><span class=\"mtk17\">&gt;&lt;/</span><span class=\"mtk4\">div</span><span class=\"mtk17\">&gt;</span><span class=\"mtk1\"> &lt;!--and The Spinny thing--&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk17\">&lt;/</span><span class=\"mtk4\">div</span><span class=\"mtk17\">&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk17\">&lt;/</span><span class=\"mtk4\">div</span><span class=\"mtk17\">&gt;</span></span></code></pre>\n<p>Easy, right? Now we need to add them styles to our html's.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"css\" data-index=\"1\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk6\">.container</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">position</span><span class=\"mtk1\">: </span><span class=\"mtk8\">fixed</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">top</span><span class=\"mtk1\">: </span><span class=\"mtk7\">0</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">left</span><span class=\"mtk1\">: </span><span class=\"mtk7\">0</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">right</span><span class=\"mtk1\">: </span><span class=\"mtk7\">0</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">bottom</span><span class=\"mtk1\">: </span><span class=\"mtk7\">0</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">text-align</span><span class=\"mtk1\">: </span><span class=\"mtk8\">center</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">background</span><span class=\"mtk1\">: </span><span class=\"mtk8\">#eee</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk6\">.container:before</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">content</span><span class=\"mtk1\">: </span><span class=\"mtk8\">&quot;&quot;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">height</span><span class=\"mtk1\">: </span><span class=\"mtk7\">100%</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">display</span><span class=\"mtk1\">: </span><span class=\"mtk8\">inline-block</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">vertical-align</span><span class=\"mtk1\">: </span><span class=\"mtk8\">middle</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span></code></pre>\n<p>Since, it's a spinner and normally covers the whole page. The combination of \"position: fixed\" and bottom, top, left, right as 0 will do that for you. ( <em>We don't want the users to click everywhere, right?</em>).</p>\n<p>The :before pseudo element will help you center the spinner correctly (without the help of negative margins). How? If you look at the container class, it has a \"text-align: center\" which aligns inline elements like the pseudo element :before. But, we need to add height on that thing and inline elements do not like that. So, we need to change the display from inline to inline-block and add \"vertical-align: middle\" so it aligns vertically.</p>\n<p><strong>Now the for the fun stuff.</strong></p>\n<p>We need to style the spinner frame.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"css\" data-index=\"2\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk6\">.container</span><span class=\"mtk1\"> </span><span class=\"mtk6\">.spinner-frame</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">display</span><span class=\"mtk1\">: </span><span class=\"mtk8\">inline-block</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">vertical-align</span><span class=\"mtk1\">: </span><span class=\"mtk8\">middle</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">width</span><span class=\"mtk1\">: </span><span class=\"mtk7\">100px</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">height</span><span class=\"mtk1\">: </span><span class=\"mtk7\">100px</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">border-radius</span><span class=\"mtk1\">: </span><span class=\"mtk7\">50%</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">position</span><span class=\"mtk1\">: </span><span class=\"mtk8\">relative</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">overflow</span><span class=\"mtk1\">: </span><span class=\"mtk8\">hidden</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">border</span><span class=\"mtk1\">: </span><span class=\"mtk7\">5px</span><span class=\"mtk1\"> </span><span class=\"mtk8\">solid</span><span class=\"mtk1\"> </span><span class=\"mtk8\">#fff</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">padding</span><span class=\"mtk1\">: </span><span class=\"mtk7\">10px</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span></code></pre>\n<p>A couple of things here. Since it's a DIV, by default it's a block element. We need to change that to an inline-block so it accepts the text-align and centers itself with the :before pseudo element. Then add a \"vertical-align: middle\" and viola!! Centered!</p>\n<p>A spinner won't be a spinner if it's not a circle. A 50% border-radius will work properly if you have a perfect 1:1 ratio. Now we need to push everything inside (and automatically center it), adding consistent padding will do that for you.</p>\n<p>Now for the foreground or spinner-cover.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"css\" data-index=\"3\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk6\">.container</span><span class=\"mtk1\"> </span><span class=\"mtk6\">.spinner-frame</span><span class=\"mtk1\"> </span><span class=\"mtk6\">.spinner-cover</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">background</span><span class=\"mtk1\">: </span><span class=\"mtk8\">#fff</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">width</span><span class=\"mtk1\">: </span><span class=\"mtk7\">100%</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">height</span><span class=\"mtk1\">: </span><span class=\"mtk7\">100%</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">border-radius</span><span class=\"mtk1\">: </span><span class=\"mtk7\">50%</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">position</span><span class=\"mtk1\">: </span><span class=\"mtk8\">relative</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">z-index</span><span class=\"mtk1\">: </span><span class=\"mtk7\">2</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span></code></pre>\n<p>This will add a white cover on top of the spinner and hide everything that we don't need inside it. You know what they say... If you can't remove it, hide it.</p>\n<p>For the spinny thing:</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"css\" data-index=\"4\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk6\">.container</span><span class=\"mtk1\"> </span><span class=\"mtk6\">.spinner-frame</span><span class=\"mtk1\"> </span><span class=\"mtk6\">.spinner-bar</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">background</span><span class=\"mtk1\">: </span><span class=\"mtk8\">#29d</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">width</span><span class=\"mtk1\">: </span><span class=\"mtk7\">50%</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">height</span><span class=\"mtk1\">: </span><span class=\"mtk7\">50%</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">position</span><span class=\"mtk1\">: </span><span class=\"mtk8\">absolute</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">top</span><span class=\"mtk1\">: </span><span class=\"mtk7\">0</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">left</span><span class=\"mtk1\">: </span><span class=\"mtk7\">0</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">border-radius</span><span class=\"mtk1\">: </span><span class=\"mtk7\">100%</span><span class=\"mtk1\"> </span><span class=\"mtk7\">0</span><span class=\"mtk1\"> </span><span class=\"mtk7\">0</span><span class=\"mtk1\"> </span><span class=\"mtk7\">0</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">-webkit-animation</span><span class=\"mtk1\">: spinny </span><span class=\"mtk7\">2s</span><span class=\"mtk1\"> </span><span class=\"mtk8\">linear</span><span class=\"mtk1\"> </span><span class=\"mtk8\">infinite</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">transform-origin</span><span class=\"mtk1\">: </span><span class=\"mtk7\">100%</span><span class=\"mtk1\"> </span><span class=\"mtk7\">100%</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk15\">@-webkit-keyframes</span><span class=\"mtk1\"> </span><span class=\"mtk12\">spinny</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    0% {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk12\">transform</span><span class=\"mtk1\">: </span><span class=\"mtk11\">rotate</span><span class=\"mtk1\">(</span><span class=\"mtk7\">0deg</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk12\">background</span><span class=\"mtk1\">: </span><span class=\"mtk8\">#29d</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    }</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    50% {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk12\">transform</span><span class=\"mtk1\">: </span><span class=\"mtk11\">rotate</span><span class=\"mtk1\">(</span><span class=\"mtk7\">180deg</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk12\">background</span><span class=\"mtk1\">: </span><span class=\"mtk8\">#00427c</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    }</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    100% {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk12\">transform</span><span class=\"mtk1\">: </span><span class=\"mtk11\">rotate</span><span class=\"mtk1\">(</span><span class=\"mtk7\">360deg</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk12\">background</span><span class=\"mtk1\">: </span><span class=\"mtk8\">#29d</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    }</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span></code></pre>\n<p>This one needs more advance CSS in it because this is the only thing that moves.</p>\n<p>We need to tell the element that the center point is not on the center of the element but on the bottom right edge where it spins. The CSS \"transform-origin: 100% 100%\" will do that easily for you.</p>\n<p>Since it's an animated element, overflow hidden (for some reason) doesn't work on this guy. So, we need to curve to top left part of it. The CSS \"border-radius: 100% 0 0 0\" will do that for you.</p>\n<p>We also need to push it on the top left where it starts spinning \"position: absolute\" with top and left 0 will push it there.</p>\n<p>Now we need to animate it using key-frames. From 0% to 100% the \"transform: rotate()\" from 0 degrees (0deg) to 360 degrees (360deg) will rotate it forever. FOREVER!</p>\n<p>A tutorial wouldn't be complete without a demo.</p>\n<p>See the Pen <a href=\"http://codepen.io/notdarryltec/pen/azVwqj/\">azVwqj</a> by Darryl Tec (<a href=\"http://codepen.io/notdarryltec\">@notdarryltec</a>) on <a href=\"http://codepen.io\">CodePen</a>.</p>\n<style class=\"grvsc-styles\">\n  .grvsc-container {\n    overflow: auto;\n    -webkit-overflow-scrolling: touch;\n    padding-top: 1rem;\n    padding-top: var(--grvsc-padding-top, var(--grvsc-padding-v, 1rem));\n    padding-bottom: 1rem;\n    padding-bottom: var(--grvsc-padding-bottom, var(--grvsc-padding-v, 1rem));\n    border-radius: 8px;\n    border-radius: var(--grvsc-border-radius, 8px);\n    font-feature-settings: normal;\n  }\n  \n  .grvsc-code {\n    display: inline-block;\n    min-width: 100%;\n  }\n  \n  .grvsc-line {\n    display: inline-block;\n    box-sizing: border-box;\n    width: 100%;\n    padding-left: 1.5rem;\n    padding-left: var(--grvsc-padding-left, var(--grvsc-padding-h, 1.5rem));\n    padding-right: 1.5rem;\n    padding-right: var(--grvsc-padding-right, var(--grvsc-padding-h, 1.5rem));\n  }\n  \n  .grvsc-line-highlighted {\n    background-color: var(--grvsc-line-highlighted-background-color, transparent);\n    box-shadow: inset var(--grvsc-line-highlighted-border-width, 4px) 0 0 0 var(--grvsc-line-highlighted-border-color, transparent);\n  }\n  \n  .dark-default-dark {\n    background-color: #1E1E1E;\n    color: #D4D4D4;\n  }\n  .dark-default-dark .mtk17 { color: #808080; }\n  .dark-default-dark .mtk4 { color: #569CD6; }\n  .dark-default-dark .mtk1 { color: #D4D4D4; }\n  .dark-default-dark .mtk12 { color: #9CDCFE; }\n  .dark-default-dark .mtk8 { color: #CE9178; }\n  .dark-default-dark .mtk6 { color: #D7BA7D; }\n  .dark-default-dark .mtk7 { color: #B5CEA8; }\n  .dark-default-dark .mtk15 { color: #C586C0; }\n  .dark-default-dark .mtk11 { color: #DCDCAA; }\n</style>","frontmatter":{"title":"Loading spinner using CSS","author":{"id":"Team LoginRadius","github":"LoginRadius","avatar":null},"date":"May 05, 2015","updated_date":null,"tags":["CSS","Loader"],"coverImage":{"childImageSharp":{"fluid":{"aspectRatio":1,"src":"/static/7892c56df8d6f6a460669e168ad41a70/7fbdd/css3-loading-spinner.webp","srcSet":"/static/7892c56df8d6f6a460669e168ad41a70/61e93/css3-loading-spinner.webp 200w,\n/static/7892c56df8d6f6a460669e168ad41a70/1f5c5/css3-loading-spinner.webp 400w,\n/static/7892c56df8d6f6a460669e168ad41a70/7fbdd/css3-loading-spinner.webp 610w","sizes":"(max-width: 610px) 100vw, 610px"}}}},"fields":{"authorId":"Team LoginRadius","slug":"/engineering/create-a-loading-spinner-using-css/"}}},{"node":{"id":"da7b062c-0cc1-555e-a505-78a658b02c7e","html":"<p>Today in the market various type of Database options are available like RDBMS, NoSQL, Big Data, Database Appliance, etc. developers can get very confused with all the choice. They do not understand why they should consider a newer, alternative database when RDBMSs have been around for 25+ years. However, many big enterprises are already using alternative databases and are saving money, innovating more quickly, and completing projects.</p>\n<p><strong>Relational Database Management System (RDBMS)</strong></p>\n<p>RDBMS Database is a relational database. It is the standard language for relational database management systems.Data is stored in the form of rows and columns in RDBMS. The relations among tables are also stored in the form of the table SQL (Structured query Language) is a programming language used to perform tasks such as update data on a database, or to retrieve data from a database. Some common relational database management systems that use SQL are: Oracle, Sybase, Microsoft SQL Server, Access, etc.</p>\n<p><strong>Features Of RDBMS</strong></p>\n<ol>\n<li>SQL databases are table based databases</li>\n<li>Data store in rows and columns</li>\n<li>Each row contains a unique instance of data for the categories defined by the columns.</li>\n<li>Provide facility primary key, to uniquely identify the rows</li>\n</ol>\n<p><strong>Limitations for SQL database</strong></p>\n<p><strong>Scalability</strong>: Users have to scale relational database on powerful servers that are expensive and difficult to handle. To scale relational database it has to be distributed on to multiple servers. Handling tables across different servers is difficult .</p>\n<p><strong>Complexity</strong>: In SQL server’s data has to fit into tables anyhow. If your data doesn’t fit into tables, then you need to design your database structure that will be complex and again difficult to handle.</p>\n<p><strong>NoSQL</strong></p>\n<p>NoSQL commonly referred to as “Not Only SQL”. With NoSQL, unstructured ,schema less data can be stored in multiple collections and nodes and it does not require fixed table sachems, it supports limited join queries , and we scale it horizontally.</p>\n<p><strong>Benefits of NoSQL</strong></p>\n<p><strong>highly and easily scalable</strong></p>\n<p>Relational database or RDBMS databases are vertically Scalable When load increase on RDBMS database then we scale database by increasing server hardware power ,need to by expensive and bigger servers and NoSQL databases are designed to expand horizontally and in Horizontal scaling means that you scale by adding more machines into your pool of resources.</p>\n<p><strong>Maintaining NoSQL Servers is Less Expensive</strong></p>\n<p>Maintaining high-end RDBMS systems is expensive and need trained manpower for database management but NoSQL databases require less management. it support many Features like automatic repair, easier data distribution, and simpler data models make administration and tuning requirements lesser in NoSQL.</p>\n<p><strong>Lesser Server Cost and open-Source</strong></p>\n<p>NoSQL databases are cheap and open source. NoSql database implementation is easy and typically uses cheap servers to manage the exploding data and transaction while RDBMS databases are expensive and it uses big servers and storage systems. So the storing and processing data cost per gigabyte in the case of NoSQL can be many times lesser than the cost of RDBMS.</p>\n<p><strong>No Schema or Fixed Data model</strong></p>\n<p>NoSQL database is schema less so Data can be inserted in a NoSQL database without any predefined schema. So the format or data model can be changed any time, without application disruption.and change management is a big headache in SQL.</p>\n<p><strong>Support Integrated Caching</strong></p>\n<p>NoSQL database support caching in system memory so it increase data output performance and SQL database where this has to be done using separate infrastructure.</p>\n<p><strong>Limitations &#x26; disadvantage of NoSQL</strong></p>\n<ol>\n<li>NoSQL database is Open Source and Open Source at its greatest strength but at the same time its greatest weakness because there are not many defined standards for NoSQL databases, so no two NoSQL databases are equal</li>\n<li>No Stored Procedures in mongodb (NoSql database).</li>\n<li>GUI mode tools to access the database is not flexibly available in market</li>\n<li>too difficult for finding nosql experts because it is latest technology and NoSQL developer are in learning mode</li>\n</ol>\n<p><strong>Conclusion</strong></p>\n<p>RDBMS and NoSQL both dbs are great in data management and both are used to keep data storage and retrieval optimized and smooth. It’s hard to say which technology is better so developer take decision according requirement and situations</p>\n<style class=\"grvsc-styles\">\n  .grvsc-container {\n    overflow: auto;\n    -webkit-overflow-scrolling: touch;\n    padding-top: 1rem;\n    padding-top: var(--grvsc-padding-top, var(--grvsc-padding-v, 1rem));\n    padding-bottom: 1rem;\n    padding-bottom: var(--grvsc-padding-bottom, var(--grvsc-padding-v, 1rem));\n    border-radius: 8px;\n    border-radius: var(--grvsc-border-radius, 8px);\n    font-feature-settings: normal;\n  }\n  \n  .grvsc-code {\n    display: inline-block;\n    min-width: 100%;\n  }\n  \n  .grvsc-line {\n    display: inline-block;\n    box-sizing: border-box;\n    width: 100%;\n    padding-left: 1.5rem;\n    padding-left: var(--grvsc-padding-left, var(--grvsc-padding-h, 1.5rem));\n    padding-right: 1.5rem;\n    padding-right: var(--grvsc-padding-right, var(--grvsc-padding-h, 1.5rem));\n  }\n  \n  .grvsc-line-highlighted {\n    background-color: var(--grvsc-line-highlighted-background-color, transparent);\n    box-shadow: inset var(--grvsc-line-highlighted-border-width, 4px) 0 0 0 var(--grvsc-line-highlighted-border-color, transparent);\n  }\n  \n</style>","frontmatter":{"title":"RDBMS vs NoSQL","author":{"id":"Team LoginRadius","github":"LoginRadius","avatar":null},"date":"April 28, 2015","updated_date":null,"tags":["Database"],"coverImage":{"childImageSharp":{"fluid":{"aspectRatio":1,"src":"/static/f5c32ff4008853f989d5847a4fb3b139/7fbdd/rdbms-vs-nosql.webp","srcSet":"/static/f5c32ff4008853f989d5847a4fb3b139/61e93/rdbms-vs-nosql.webp 200w,\n/static/f5c32ff4008853f989d5847a4fb3b139/1f5c5/rdbms-vs-nosql.webp 400w,\n/static/f5c32ff4008853f989d5847a4fb3b139/7fbdd/rdbms-vs-nosql.webp 610w","sizes":"(max-width: 610px) 100vw, 610px"}}}},"fields":{"authorId":"Team LoginRadius","slug":"/engineering/relational-database-management-system-rdbms-vs-nosql/"}}},{"node":{"id":"0f613b12-b271-5762-aa6d-8e91934a5860","html":"<p>PhoneGap now also known as Apache Cordova, is a powerful tool for mobile development which allows you to develop in HTML/JS markup and quickly generate out various mobile compatible apps. This prevents your developers from having to learn and understand multiple platform specific languages and instead use the PhoneGap framework which is based in HTML to create the app and then generate it into any one of the following platforms:</p>\n<ol>\n<li>iOS</li>\n<li>Android</li>\n<li>Windows Phone</li>\n<li>Windows</li>\n<li>Firefox OS</li>\n<li>Amazon Fire OS</li>\n<li>Blackberry</li>\n</ol>\n<p>With time saved on learning development languages for the above platforms your team can focus on the features of your app.</p>\n<h2 id=\"setting-up-your-environment\" style=\"position:relative;\"><a href=\"#setting-up-your-environment\" aria-label=\"setting up your environment permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><strong>Setting up your Environment</strong></h2>\n<ol>\n<li>Download and install <a href=\"http://nodejs.org/download/\">node.js</a>, This will be used to install the Cordova/PhoneGap framework.</li>\n<li>Download and install a <a href=\"http://git-scm.com/downloads\">Git Client</a>, This is used by the Cordova/PhoneGap framework when creating projects.</li>\n<li>Open command prompt and verify that both of the above systems have been installed by running <em>npm</em> and <em>git.</em></li>\n<li>Install the Cordova/PhoneGap system by running the following command in your command prompt (Note: this may take a few minutes)</li>\n</ol>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"\" data-index=\"0\"><code class=\"grvsc-code\"><span class=\"grvsc-line\">C:\\&gt;npm install -g cordova</span></code></pre>\n<p>Verify your installation of Cordova/PhoneGap by running <em>cordova</em> in command prompt. This should display a list of the available Cordova commands.</p>\n<h2 id=\"setting-up-your-project\" style=\"position:relative;\"><a href=\"#setting-up-your-project\" aria-label=\"setting up your project permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><strong>Setting up your Project</strong></h2>\n<ol>\n<li>Create a directory which will contain your PhoneGap/Cordova project code.</li>\n<li>Open the created directory in command line and create a project with the command <strong>cordova create &#x3C; sitename ></strong></li>\n</ol>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"\" data-index=\"1\"><code class=\"grvsc-code\"><span class=\"grvsc-line\">C:\\&gt;rootdir\\cordova create FirstSite</span></code></pre>\n<ol start=\"3\">\n<li>\n<p>This will create a project in the root folder with the specified site-name. This project will contain:</p>\n<ol>\n<li>\"hooks\" directory- Contains special scripts that can be used to customize Cordova commands.</li>\n<li>\"platforms\" directory- This contains the app specific projects that you will include below.</li>\n<li>\"plugins\" directory- Contains add-on code for interfacing with native features. You can create your own custom interface or use one of pre-compiled plugins.</li>\n<li>\"www\" directory- Contains the PhoneGap/Cordova structure and some standard js and css files.</li>\n<li>config.xml file- This file contains meta data for controlling common features of your apps like the app title, description and author.</li>\n</ol>\n</li>\n<li>\n<p>Add platforms to the project with the <em>cordova platform add <platform></em> command. <strong>Note:</strong> adding platforms requires that the relevant dependencies are installed in your system for example adding android requires that you have installed the Android SDK. Available platforms for a windows environment are:</p>\n<ul>\n<li>wp7</li>\n<li>wp8</li>\n<li>windows8</li>\n<li>amazon-fireos</li>\n<li>android</li>\n<li>blackberry10</li>\n<li>firefoxos</li>\n</ul>\n<p>And for Mac:</p>\n<ul>\n<li>ios</li>\n<li>amazon-fireos</li>\n<li>android</li>\n<li>blacberry10</li>\n<li>firefoxos</li>\n</ul>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"\" data-index=\"2\"><code class=\"grvsc-code\"><span class=\"grvsc-line\">C:\\&gt;rootdir\\cordova platform add android</span></code></pre>\n</li>\n<li>\n<p> You can now get a list of the added platforms by running the following command:</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"\" data-index=\"3\"><code class=\"grvsc-code\"><span class=\"grvsc-line\">C:\\&gt;rootdir\\cordova platform ls</span></code></pre>\n</li>\n<li>\n<p>You can remove a specific platform from the list with the following command:</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"\" data-index=\"4\"><code class=\"grvsc-code\"><span class=\"grvsc-line\">C:\\&gt;rootdir\\cordova platform remove android</span></code></pre>\n</li>\n<li>Once you have added in the desired platforms build the platform specific apps by running the following command: </li>\n</ol>\n<p><strong>Note:</strong> Building platforms requires that the relevant dependencies are installed in your system for example building android requires that you have installed the Android SDK</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"\" data-index=\"5\"><code class=\"grvsc-code\"><span class=\"grvsc-line\">C:\\&gt;rootdir\\cordova build</span></code></pre>\n<ol start=\"8\">\n<li>You can use these built projects found in the \"platforms\" directory in platform specific IDEs or emulate the projects directly with the following command:</li>\n</ol>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"\" data-index=\"6\"><code class=\"grvsc-code\"><span class=\"grvsc-line\">C:\\&gt;rootdir\\cordova emulate android</span></code></pre>\n<p>At this point you have a basic PhoneGap project configured and your desired platforms added and you can get started with adding or building out additional features and content in the \"www\" directory and run the command in step 7 above to create the platform specific projects. You can find detailed instructions on setting up additional features and implementing PhoneGap on the PhoneGap site.</p>\n<style class=\"grvsc-styles\">\n  .grvsc-container {\n    overflow: auto;\n    -webkit-overflow-scrolling: touch;\n    padding-top: 1rem;\n    padding-top: var(--grvsc-padding-top, var(--grvsc-padding-v, 1rem));\n    padding-bottom: 1rem;\n    padding-bottom: var(--grvsc-padding-bottom, var(--grvsc-padding-v, 1rem));\n    border-radius: 8px;\n    border-radius: var(--grvsc-border-radius, 8px);\n    font-feature-settings: normal;\n  }\n  \n  .grvsc-code {\n    display: inline-block;\n    min-width: 100%;\n  }\n  \n  .grvsc-line {\n    display: inline-block;\n    box-sizing: border-box;\n    width: 100%;\n    padding-left: 1.5rem;\n    padding-left: var(--grvsc-padding-left, var(--grvsc-padding-h, 1.5rem));\n    padding-right: 1.5rem;\n    padding-right: var(--grvsc-padding-right, var(--grvsc-padding-h, 1.5rem));\n  }\n  \n  .grvsc-line-highlighted {\n    background-color: var(--grvsc-line-highlighted-background-color, transparent);\n    box-shadow: inset var(--grvsc-line-highlighted-border-width, 4px) 0 0 0 var(--grvsc-line-highlighted-border-color, transparent);\n  }\n  \n  .dark-default-dark {\n    background-color: #1E1E1E;\n    color: #D4D4D4;\n  }\n</style>","frontmatter":{"title":"Getting Started with Phonegap","author":{"id":"Team LoginRadius","github":"LoginRadius","avatar":null},"date":"March 31, 2015","updated_date":null,"tags":["Engineering","PhoneGap","Mobile"],"coverImage":{"childImageSharp":{"fluid":{"aspectRatio":1,"src":"/static/02771814b93eac090637b118855c7008/22f90/dev-sprites2.webp","srcSet":"/static/02771814b93eac090637b118855c7008/61e93/dev-sprites2.webp 200w,\n/static/02771814b93eac090637b118855c7008/1f5c5/dev-sprites2.webp 400w,\n/static/02771814b93eac090637b118855c7008/22f90/dev-sprites2.webp 580w","sizes":"(max-width: 580px) 100vw, 580px"}}}},"fields":{"authorId":"Team LoginRadius","slug":"/engineering/getting-started-phonegap/"}}},{"node":{"id":"97b17b35-96cc-5d86-ba88-88ee56c4a6c8","html":"<p>By now you’ve probably seen the cool and simple way(not to mention, without using jQuery) of creating a  popup by Zoie Carnegie. If not, you can click this <a href=\"/simple-popup-tutorial/\">link</a> to go and follow that tutorial. Cool?</p>\n<p>Once you’re done creating your css popup. We’re now going to animate it with CSS3. Why? because we’re tired of seeing things that just pop onto users screen and you don’t know where it came from. Also, to make it fun for your users. Let's get started.</p>\n<p>First things first. CSS3 animations don't work on \"display: none\" or \"block\". So, we need to modify Zoie's code to not do that and just simply add and remove the relevant class.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"css\" data-index=\"0\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\">// Close Popup Event</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">closePopup</span><span class=\"mtk6\">.onclick</span><span class=\"mtk1\"> = function() {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    overlay.className = &#39;&#39;; </span><span class=\"mtk3\">/*This removes all classes, use at your own risk*/</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    popup.className = &#39;&#39;; </span><span class=\"mtk3\">/*This removes all classes, use at your own risk*/</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">};</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">// Show Overlay and Popup</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk6\">button.onclick</span><span class=\"mtk1\"> = function() {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    overlay.className = &#39;show&#39;;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    popup.className = &#39;show&#39;;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span></code></pre>\n<p>We need to modify the CSS too.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"css\" data-index=\"1\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk6\">#popup</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">visibility</span><span class=\"mtk1\">: </span><span class=\"mtk8\">hidden</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">opacity</span><span class=\"mtk1\">: </span><span class=\"mtk7\">0</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">z-index</span><span class=\"mtk1\">: </span><span class=\"mtk7\">-1</span><span class=\"mtk1\">; </span><span class=\"mtk3\">/*hide it in the back of the page*/</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk6\">#overlay</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">visibility</span><span class=\"mtk1\">: </span><span class=\"mtk8\">hidden</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">opacity</span><span class=\"mtk1\">: </span><span class=\"mtk7\">0</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">z-index</span><span class=\"mtk1\">: </span><span class=\"mtk7\">-1</span><span class=\"mtk1\">; </span><span class=\"mtk3\">/*hide it in the back of the page*/</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span></code></pre>\n<p>Now, why did I do that? Since, we can't use display: none, we need to find a way to hide it differently. CSS3 animation works perfectly with \"visibility: hidden\", \"opacity\" and \"z-index\". I know it's a bit more CSS but, I assure you that it's worth it.</p>\n<p><strong>Slide Down</strong></p>\n<p>Let's start with a simple one. Sliding them pops, yo!</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"css\" data-index=\"2\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk3\">/*Add defaults*/</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk6\">#popup</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">top</span><span class=\"mtk1\">: </span><span class=\"mtk7\">-50%</span><span class=\"mtk1\">; </span><span class=\"mtk3\">/*Put it on the very top*/</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">transition</span><span class=\"mtk1\">: </span><span class=\"mtk8\">all</span><span class=\"mtk1\"> </span><span class=\"mtk7\">.5s</span><span class=\"mtk1\"> </span><span class=\"mtk8\">ease-in-out</span><span class=\"mtk1\">; </span><span class=\"mtk3\">/*make it smooth*/</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk3\">/*Now show it*/</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk6\">#popup.show</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">visibility</span><span class=\"mtk1\">: </span><span class=\"mtk8\">visible</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">z-index</span><span class=\"mtk1\">: </span><span class=\"mtk7\">200</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">opacity</span><span class=\"mtk1\">: </span><span class=\"mtk7\">1</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">   </span><span class=\"mtk12\">top</span><span class=\"mtk1\">: </span><span class=\"mtk7\">50%</span><span class=\"mtk1\">; </span><span class=\"mtk3\">/*slide it down smoothly*/</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk6\">#popup.show</span><span class=\"mtk1\"> ~ </span><span class=\"mtk6\">#overlay</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">opacity</span><span class=\"mtk1\">: </span><span class=\"mtk7\">1</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">visibility</span><span class=\"mtk1\">: </span><span class=\"mtk8\">visible</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">z-index</span><span class=\"mtk1\">: </span><span class=\"mtk7\">100</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span></code></pre>\n<p>The \"top: -50%\" will push our pop-up outside while \"top: 50%\" will bring it back to the center. Now, combine it with a CSS transition and it will gracefully slide down along with the fading effect of opacity. Pretty neat huh? How about making it pop up from the center of the page? I mean it's called \"pop-up\" for a reason right?</p>\n<p>We can achieve that effect by using the same code we made earlier. Just change the \"top: -50%\" to \"transform: scale(0)\". This will scale our beloved pop-up to a small size. The showing it part will have to change too. Same as the default, change the \"top: 50%\" to \"transform: scale(1)\". This will then scale it back to original size.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"css\" data-index=\"3\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk3\">/*Add defaults*/</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk6\">#popup</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">transform</span><span class=\"mtk1\">: </span><span class=\"mtk11\">scale</span><span class=\"mtk1\">(</span><span class=\"mtk7\">0</span><span class=\"mtk1\">) </span><span class=\"mtk3\">/*scale it to a smaller size*/</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  transition: </span><span class=\"mtk8\">all</span><span class=\"mtk1\"> </span><span class=\"mtk7\">.5s</span><span class=\"mtk1\"> </span><span class=\"mtk8\">ease-in-out</span><span class=\"mtk1\">; </span><span class=\"mtk3\">/*make it smooth*/</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk3\">/*Now show it*/</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk6\">#popup.show</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">visibility</span><span class=\"mtk1\">: </span><span class=\"mtk8\">visible</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">z-index</span><span class=\"mtk1\">: </span><span class=\"mtk7\">200</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">opacity</span><span class=\"mtk1\">: </span><span class=\"mtk7\">1</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">transform</span><span class=\"mtk1\">: </span><span class=\"mtk11\">scale</span><span class=\"mtk1\">(</span><span class=\"mtk7\">1</span><span class=\"mtk1\">) </span><span class=\"mtk3\">/*scale it to a default size*/</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk6\">#popup.show</span><span class=\"mtk1\"> ~ </span><span class=\"mtk6\">#overlay</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">opacity</span><span class=\"mtk1\">: </span><span class=\"mtk7\">1</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">visibility</span><span class=\"mtk1\">: </span><span class=\"mtk8\">visible</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">z-index</span><span class=\"mtk1\">: </span><span class=\"mtk7\">100</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span></code></pre>\n<p>Want to try something different than that? I got your back.</p>\n<p><strong>Swirly Pop</strong></p>\n<p>Have you heard of CSS keyframes? We're going to use that to achieve what we want. I just want to say first that CSS keyframes <strong>do not</strong> work on older browsers like IE8 and IE9. Use this trick at your own risk.</p>\n<p>The keyframes code looks like this</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"css\" data-index=\"4\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk15\">@keyframes</span><span class=\"mtk1\"> </span><span class=\"mtk12\">pop-swirl</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  0% {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">transform</span><span class=\"mtk1\">: </span><span class=\"mtk11\">scale</span><span class=\"mtk1\">(</span><span class=\"mtk7\">0</span><span class=\"mtk1\">) </span><span class=\"mtk11\">rotate</span><span class=\"mtk1\">(</span><span class=\"mtk7\">360deg</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  }</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  60% {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">transform</span><span class=\"mtk1\">: </span><span class=\"mtk11\">scale</span><span class=\"mtk1\">(</span><span class=\"mtk7\">0.8</span><span class=\"mtk1\">) </span><span class=\"mtk11\">rotate</span><span class=\"mtk1\">(</span><span class=\"mtk7\">-10deg</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  }</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  100% {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">transform</span><span class=\"mtk1\">: </span><span class=\"mtk11\">scale</span><span class=\"mtk1\">(</span><span class=\"mtk7\">1</span><span class=\"mtk1\">) </span><span class=\"mtk11\">rotate</span><span class=\"mtk1\">(</span><span class=\"mtk7\">0deg</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  }</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span></code></pre>\n<p>The word \"pop-swirl\" is the variable we need to call later on to trigger that animation or keyframe. You can name this to whatever you want, there are no restrictions. The animation works by specifying your start and end points. There's 2 ways you can do that, either by using \"from\" and \"to\" or \"0%\" to \"100%\". I prefer the 2nd way because you can add like 100 keyframes to it.</p>\n<p>Calling that code will need the help of an \"animation\" tag. This is like a transition but more advanced. I also like to point out that right now, It's not fully supported yet but you can still use it by appending your vendor prefix like \"-webkit-\". Like this...</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"\" data-index=\"5\"><code class=\"grvsc-code\"><span class=\"grvsc-line\">\\-webkit-animation: pop-swirl 1s ease forwards;</span></code></pre>\n<p>Let's break this down</p>\n<p><strong>-webkit-</strong> = Vendor prefix.<br>\n<strong>animation</strong> = Used to call the keyframes.<br>\n<strong>pop-swirl</strong> = The variable we used on keyframes.<br>\n<strong>1s</strong> = Duration of animation.<br>\n<strong>ease</strong> = Timing function. This can also make the animation smoother.<br>\n<strong>forwards</strong> = This is the <a href=\"http://www.w3schools.com/cssref/css3_pr_animation-play-state.asp\">animation play state</a>.</p>\n<p>Using the same method as Slide Down and Pop In. We just need to remove top or transform tags and add the animation tag in it.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"css\" data-index=\"6\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk3\">/*Don&#39;t need the defaults*/</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk3\">/*Now show it*/</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk6\">#popup.show</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">-webkit-animation</span><span class=\"mtk1\">: pop-swirl </span><span class=\"mtk7\">1s</span><span class=\"mtk1\"> </span><span class=\"mtk8\">ease</span><span class=\"mtk1\"> </span><span class=\"mtk8\">forwards</span><span class=\"mtk1\">; </span><span class=\"mtk3\">/*trigger the keyframe*/</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">visibility</span><span class=\"mtk1\">: </span><span class=\"mtk8\">visible</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">z-index</span><span class=\"mtk1\">: </span><span class=\"mtk7\">200</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">opacity</span><span class=\"mtk1\">: </span><span class=\"mtk7\">1</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk6\">#popup.show</span><span class=\"mtk1\"> ~ </span><span class=\"mtk6\">#overlay</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">opacity</span><span class=\"mtk1\">: </span><span class=\"mtk7\">1</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">visibility</span><span class=\"mtk1\">: </span><span class=\"mtk8\">visible</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">z-index</span><span class=\"mtk1\">: </span><span class=\"mtk7\">100</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span></code></pre>\n<p><strong>Bonus!</strong></p>\n<p><strong>The Anvil Effect</strong></p>\n<p>Let's shock your screen with this heavy pop-up. You can achieve the anvil effect by using this code.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"css\" data-index=\"7\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk15\">@keyframes</span><span class=\"mtk1\"> </span><span class=\"mtk12\">anvil</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  0% {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">transform</span><span class=\"mtk1\">: </span><span class=\"mtk11\">scale</span><span class=\"mtk1\">(</span><span class=\"mtk7\">5</span><span class=\"mtk1\">) </span><span class=\"mtk11\">rotate</span><span class=\"mtk1\">(</span><span class=\"mtk7\">0</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">opacity</span><span class=\"mtk1\">: </span><span class=\"mtk7\">0</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">box-shadow</span><span class=\"mtk1\">: </span><span class=\"mtk7\">0</span><span class=\"mtk1\"> </span><span class=\"mtk7\">0</span><span class=\"mtk1\"> </span><span class=\"mtk7\">0</span><span class=\"mtk1\"> </span><span class=\"mtk11\">rgba</span><span class=\"mtk1\">(</span><span class=\"mtk7\">241</span><span class=\"mtk1\">, </span><span class=\"mtk7\">241</span><span class=\"mtk1\">, </span><span class=\"mtk7\">241</span><span class=\"mtk1\">, </span><span class=\"mtk7\">0</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  }</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  50% {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">transform</span><span class=\"mtk1\">: </span><span class=\"mtk11\">scale</span><span class=\"mtk1\">(</span><span class=\"mtk7\">1</span><span class=\"mtk1\">) </span><span class=\"mtk11\">rotate</span><span class=\"mtk1\">(</span><span class=\"mtk7\">-0.2deg</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">opacity</span><span class=\"mtk1\">: </span><span class=\"mtk7\">1</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">box-shadow</span><span class=\"mtk1\">: </span><span class=\"mtk7\">0</span><span class=\"mtk1\"> </span><span class=\"mtk7\">0</span><span class=\"mtk1\"> </span><span class=\"mtk7\">0</span><span class=\"mtk1\"> </span><span class=\"mtk11\">rgba</span><span class=\"mtk1\">(</span><span class=\"mtk7\">241</span><span class=\"mtk1\">, </span><span class=\"mtk7\">241</span><span class=\"mtk1\">, </span><span class=\"mtk7\">241</span><span class=\"mtk1\">, </span><span class=\"mtk7\">0.5</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  }</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  75% {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">transform</span><span class=\"mtk1\">: </span><span class=\"mtk11\">scale</span><span class=\"mtk1\">(</span><span class=\"mtk7\">1</span><span class=\"mtk1\">) </span><span class=\"mtk11\">rotate</span><span class=\"mtk1\">(</span><span class=\"mtk7\">0.2deg</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">opacity</span><span class=\"mtk1\">: </span><span class=\"mtk7\">1</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">box-shadow</span><span class=\"mtk1\">: </span><span class=\"mtk7\">0</span><span class=\"mtk1\"> </span><span class=\"mtk7\">0</span><span class=\"mtk1\"> </span><span class=\"mtk7\">250px</span><span class=\"mtk1\"> </span><span class=\"mtk11\">rgba</span><span class=\"mtk1\">(</span><span class=\"mtk7\">241</span><span class=\"mtk1\">, </span><span class=\"mtk7\">241</span><span class=\"mtk1\">, </span><span class=\"mtk7\">241</span><span class=\"mtk1\">, </span><span class=\"mtk7\">0.5</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  }</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  100% {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">transform</span><span class=\"mtk1\">: </span><span class=\"mtk11\">scale</span><span class=\"mtk1\">(</span><span class=\"mtk7\">1</span><span class=\"mtk1\">) </span><span class=\"mtk11\">rotate</span><span class=\"mtk1\">(</span><span class=\"mtk7\">0</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">opacity</span><span class=\"mtk1\">: </span><span class=\"mtk7\">1</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">box-shadow</span><span class=\"mtk1\">: </span><span class=\"mtk7\">0</span><span class=\"mtk1\"> </span><span class=\"mtk7\">0</span><span class=\"mtk1\"> </span><span class=\"mtk7\">500px</span><span class=\"mtk1\"> </span><span class=\"mtk11\">rgba</span><span class=\"mtk1\">(</span><span class=\"mtk7\">241</span><span class=\"mtk1\">, </span><span class=\"mtk7\">241</span><span class=\"mtk1\">, </span><span class=\"mtk7\">241</span><span class=\"mtk1\">, </span><span class=\"mtk7\">0</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  }</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk6\">#popup</span><span class=\"mtk1\">[</span><span class=\"mtk12\">data-pop</span><span class=\"mtk1\">=</span><span class=\"mtk8\">&quot;anvil&quot;</span><span class=\"mtk1\">]</span><span class=\"mtk6\">.show</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">-webkit-animation</span><span class=\"mtk1\">: anvil </span><span class=\"mtk7\">1s</span><span class=\"mtk1\"> </span><span class=\"mtk11\">cubic-bezier</span><span class=\"mtk1\">(</span><span class=\"mtk7\">0.38</span><span class=\"mtk1\">, </span><span class=\"mtk7\">0.1</span><span class=\"mtk1\">, </span><span class=\"mtk7\">0.36</span><span class=\"mtk1\">, </span><span class=\"mtk7\">0.9</span><span class=\"mtk1\">) </span><span class=\"mtk8\">forwards</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">visibility</span><span class=\"mtk1\">: </span><span class=\"mtk8\">visible</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">z-index</span><span class=\"mtk1\">: </span><span class=\"mtk7\">200</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">opacity</span><span class=\"mtk1\">: </span><span class=\"mtk7\">1</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk6\">#popup</span><span class=\"mtk1\">[</span><span class=\"mtk12\">data-pop</span><span class=\"mtk1\">=</span><span class=\"mtk8\">&quot;anvil&quot;</span><span class=\"mtk1\">]</span><span class=\"mtk6\">.show</span><span class=\"mtk1\"> ~ </span><span class=\"mtk6\">#overlay</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">opacity</span><span class=\"mtk1\">: </span><span class=\"mtk7\">1</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">visibility</span><span class=\"mtk1\">: </span><span class=\"mtk8\">visible</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">z-index</span><span class=\"mtk1\">: </span><span class=\"mtk7\">100</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span></code></pre>\n<p>Of course a tutorial won't be complete without a demo.</p>\n<p><a href=\"https://codepen.io/notdarryltec/full/ByOBvj/\">Slide Down Demo</a> <a href=\"http://codepen.io/notdarryltec/full/YPOKdb/\">Pop In Demo</a> <a href=\"https://codepen.io/notdarryltec/full/yyxBZo/\">Pop Swirl Demo</a> <a href=\"https://codepen.io/notdarryltec/full/KwxPrm/\">Anvil Demo</a></p>\n<p>And there you have it. A little something to spice up your pop-up game. I hope this helps you woo your users and entertain them. Until next time. Cheers.</p>\n<style class=\"grvsc-styles\">\n  .grvsc-container {\n    overflow: auto;\n    -webkit-overflow-scrolling: touch;\n    padding-top: 1rem;\n    padding-top: var(--grvsc-padding-top, var(--grvsc-padding-v, 1rem));\n    padding-bottom: 1rem;\n    padding-bottom: var(--grvsc-padding-bottom, var(--grvsc-padding-v, 1rem));\n    border-radius: 8px;\n    border-radius: var(--grvsc-border-radius, 8px);\n    font-feature-settings: normal;\n  }\n  \n  .grvsc-code {\n    display: inline-block;\n    min-width: 100%;\n  }\n  \n  .grvsc-line {\n    display: inline-block;\n    box-sizing: border-box;\n    width: 100%;\n    padding-left: 1.5rem;\n    padding-left: var(--grvsc-padding-left, var(--grvsc-padding-h, 1.5rem));\n    padding-right: 1.5rem;\n    padding-right: var(--grvsc-padding-right, var(--grvsc-padding-h, 1.5rem));\n  }\n  \n  .grvsc-line-highlighted {\n    background-color: var(--grvsc-line-highlighted-background-color, transparent);\n    box-shadow: inset var(--grvsc-line-highlighted-border-width, 4px) 0 0 0 var(--grvsc-line-highlighted-border-color, transparent);\n  }\n  \n  .dark-default-dark {\n    background-color: #1E1E1E;\n    color: #D4D4D4;\n  }\n  .dark-default-dark .mtk1 { color: #D4D4D4; }\n  .dark-default-dark .mtk6 { color: #D7BA7D; }\n  .dark-default-dark .mtk3 { color: #6A9955; }\n  .dark-default-dark .mtk12 { color: #9CDCFE; }\n  .dark-default-dark .mtk8 { color: #CE9178; }\n  .dark-default-dark .mtk7 { color: #B5CEA8; }\n  .dark-default-dark .mtk11 { color: #DCDCAA; }\n  .dark-default-dark .mtk15 { color: #C586C0; }\n</style>","frontmatter":{"title":"Animate the modal popup using CSS","author":{"id":"Team LoginRadius","github":"LoginRadius","avatar":null},"date":"March 23, 2015","updated_date":null,"tags":["Slide","CSS","Swirl","PopUp"],"coverImage":{"childImageSharp":{"fluid":{"aspectRatio":1,"src":"/static/fd58cd8b2750bcda4251057bf96d6b25/ad85c/simplepop.webp","srcSet":"/static/fd58cd8b2750bcda4251057bf96d6b25/61e93/simplepop.webp 200w,\n/static/fd58cd8b2750bcda4251057bf96d6b25/1f5c5/simplepop.webp 400w,\n/static/fd58cd8b2750bcda4251057bf96d6b25/ad85c/simplepop.webp 600w","sizes":"(max-width: 600px) 100vw, 600px"}}}},"fields":{"authorId":"Team LoginRadius","slug":"/engineering/animating-simple-css-popup-tutorial/"}}},{"node":{"id":"748f76a4-22c7-59b2-98fc-63c818315455","html":"<p>I know what you're thinking. Why am I writing this blog? There's like a bunch of apps out there that do this thing automatically. See, that's the problem, \"automatically\". That means you have no control over it when it messes things up. Even if you do, you might mess things up for other stuff too.</p>\n<p>This is why controlling your own code is better than letting other apps do it. Just like what my mentor said, \"Don't let the apps write your own code, they screw it up\".</p>\n<p><strong>Let's get started</strong></p>\n<p>Let's make a responsive grid without using any crazy percentages or complicated margins. Sounds cool? Good.</p>\n<p>By now you know how complicated it is to calculate all the width and margins to make sure they correspond with each other. Not to mention that you need to use percentages on both of them which sometimes doesn't work, especially with our friend IE8.</p>\n<p>What if we create a grid that doesn't need margins for spacing? Or using percentages to separate objects? Sounds awesome right? No more calculating for the right percentages and getting crazy numbers.</p>\n<p>Let's start with 4 grids first. So 100 / 4 = 25 then add a percentage (%) sign and we get 25% for our 4 grid system. No crazy numbers there, but we need spacing. To add spaces between those elements just add padding on left and right. Pixels or percent, it's up to you. Yes, yes, padding adds width but, if you add \"box-sizing: border box\" on our lovely grid, the padding will start respecting your decision to add a width of 25% and start pushing everything inside.</p>\n<p><img src=\"/061ca7bb25044306d0f8d74f574250ce/grid.webp\" alt=\"grid\"></p>\n<p>There you have it, Spacing. By now your CSS code will look like this.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"css\" data-index=\"0\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk6\">div</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">width</span><span class=\"mtk1\">: </span><span class=\"mtk7\">25%</span><span class=\"mtk1\">;</span><span class=\"mtk3\">/*4 grid system*/</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">padding</span><span class=\"mtk1\">: </span><span class=\"mtk7\">0</span><span class=\"mtk1\"> </span><span class=\"mtk7\">5px</span><span class=\"mtk1\">;</span><span class=\"mtk3\">/*spacing*/</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">box-sizing</span><span class=\"mtk1\">: </span><span class=\"mtk8\">border-box</span><span class=\"mtk1\">;</span><span class=\"mtk3\">/*removes the added with from padding*/</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">float</span><span class=\"mtk1\">: </span><span class=\"mtk8\">left</span><span class=\"mtk1\">; </span><span class=\"mtk3\">/*put them side by side*/</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span></code></pre>\n<p><strong>Problem</strong></p>\n<p>Of course, there's no perfect code. Since we're using padding on both left and right. you'll see some spacing too on the left and right side of your website. For example, I used 5px padding. That means I will have a 5px offset on the left and right side of my screen. It doesn't align with my site anymore.</p>\n<p><strong>Solution</strong></p>\n<p>To tackle this problem we need to add a margin on the parent of our grid. Since my padding is 5px, I need to add a -5px margin on left and right to stretch it back to it's intended size. So our code will look like this now.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"css\" data-index=\"1\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\">parent {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">margin</span><span class=\"mtk1\">: </span><span class=\"mtk7\">0</span><span class=\"mtk1\"> </span><span class=\"mtk7\">-5px</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">parent </span><span class=\"mtk6\">div</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">width</span><span class=\"mtk1\">: </span><span class=\"mtk7\">25%</span><span class=\"mtk1\">;</span><span class=\"mtk3\">/*4 grid system*/</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">padding</span><span class=\"mtk1\">: </span><span class=\"mtk7\">0</span><span class=\"mtk1\"> </span><span class=\"mtk7\">5px</span><span class=\"mtk1\">;</span><span class=\"mtk3\">/*spacing*/</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">box-sizing</span><span class=\"mtk1\">: </span><span class=\"mtk8\">border-box</span><span class=\"mtk1\">;</span><span class=\"mtk3\">/*removes the added with from padding*/</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">float</span><span class=\"mtk1\">: </span><span class=\"mtk8\">left</span><span class=\"mtk1\">; </span><span class=\"mtk3\">/*put them side by side*/</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span></code></pre>\n<p> I'd like to also point out that if your parent has a width (which it doesn't really need because our grid css will add a width to the parent), the negative margins won't work. So, be careful.</p>\n<p>Another thing to watch out for, because we're using floats, we will also need to use a clearfix hack on our parent.</p>\n<p>Using the simple code we learned today will create all the grids you want.</p>\n<p>1 = 100%<br>\n2 = 50%<br>\n3 = 33.33%<br>\n4 = 25%<br>\n5 = 20%<br>\n6 = 16.66%<br>\n7 = 14.28%<br>\n8 = 12.5%<br>\n9 = 11.11%<br>\n10 = 10%</p>\n<p>and so on.</p>\n<p>See it on <a href=\"https://codepen.io/notdarryltec/pen/emMpQB\">codepen</a>.</p>\n<p>And this is where it ends. I hope this will help you easily create a grid in the near future. If you have any other tips, leave it in the comments and I'll be happy to try it out. Cheers.</p>\n<style class=\"grvsc-styles\">\n  .grvsc-container {\n    overflow: auto;\n    -webkit-overflow-scrolling: touch;\n    padding-top: 1rem;\n    padding-top: var(--grvsc-padding-top, var(--grvsc-padding-v, 1rem));\n    padding-bottom: 1rem;\n    padding-bottom: var(--grvsc-padding-bottom, var(--grvsc-padding-v, 1rem));\n    border-radius: 8px;\n    border-radius: var(--grvsc-border-radius, 8px);\n    font-feature-settings: normal;\n  }\n  \n  .grvsc-code {\n    display: inline-block;\n    min-width: 100%;\n  }\n  \n  .grvsc-line {\n    display: inline-block;\n    box-sizing: border-box;\n    width: 100%;\n    padding-left: 1.5rem;\n    padding-left: var(--grvsc-padding-left, var(--grvsc-padding-h, 1.5rem));\n    padding-right: 1.5rem;\n    padding-right: var(--grvsc-padding-right, var(--grvsc-padding-h, 1.5rem));\n  }\n  \n  .grvsc-line-highlighted {\n    background-color: var(--grvsc-line-highlighted-background-color, transparent);\n    box-shadow: inset var(--grvsc-line-highlighted-border-width, 4px) 0 0 0 var(--grvsc-line-highlighted-border-color, transparent);\n  }\n  \n  .dark-default-dark {\n    background-color: #1E1E1E;\n    color: #D4D4D4;\n  }\n  .dark-default-dark .mtk6 { color: #D7BA7D; }\n  .dark-default-dark .mtk1 { color: #D4D4D4; }\n  .dark-default-dark .mtk12 { color: #9CDCFE; }\n  .dark-default-dark .mtk7 { color: #B5CEA8; }\n  .dark-default-dark .mtk3 { color: #6A9955; }\n  .dark-default-dark .mtk8 { color: #CE9178; }\n</style>","frontmatter":{"title":"CSS Responsive Grid, Re-imagined","author":{"id":"Team LoginRadius","github":"LoginRadius","avatar":null},"date":"March 16, 2015","updated_date":null,"tags":["CSS","Grid","Responsive"],"coverImage":{"childImageSharp":{"fluid":{"aspectRatio":1,"src":"/static/b965f64c315a9fddcd7037c0d1e1441f/ad85c/desdev.webp","srcSet":"/static/b965f64c315a9fddcd7037c0d1e1441f/61e93/desdev.webp 200w,\n/static/b965f64c315a9fddcd7037c0d1e1441f/1f5c5/desdev.webp 400w,\n/static/b965f64c315a9fddcd7037c0d1e1441f/ad85c/desdev.webp 600w","sizes":"(max-width: 600px) 100vw, 600px"}}}},"fields":{"authorId":"Team LoginRadius","slug":"/engineering/css-responsive-grid/"}}},{"node":{"id":"f6633a4e-e2a1-5028-9180-641517df104b","html":"<p>Are you tired of eye dropping (or worse… guessing) the colors of every social network you like? Fear not my friend, I have searched the webs to find our beloved social media colors and listed it out in hex form.</p>\n<p><strong>Facebook</strong> #3b5998</p>\n<p><strong>Google Plus</strong> #F90101</p>\n<p><strong>Linkedin</strong> #007bb6</p>\n<p><strong>Twitter</strong> #55acee</p>\n<p><strong>Yahoo</strong> #400090</p>\n<p><strong>Amazon</strong> #FF9900</p>\n<p><strong>Aol</strong> #066cb1</p>\n<p><strong>Delicious</strong> #67b6e3</p>\n<p><strong>Digg</strong> #486ca3</p>\n<p><strong>Disqus</strong> #35a8ff</p>\n<p><strong>Foursquare</strong> #1cafec</p>\n<p><strong>Github</strong> #181616</p>\n<p><strong>Google</strong> #0266C8</p>\n<p><strong>Hyves</strong> #f9a539</p>\n<p><strong>Instagram</strong> #406e94</p>\n<p><strong>Kaixin</strong> #bb0e0f</p>\n<p><strong>Live</strong> #004C9A</p>\n<p><strong>Livejournal</strong> #3770a3</p>\n<p><strong>Mixi</strong> #d1ad5a</p>\n<p><strong>Myspace</strong> #313131</p>\n<p><strong>Odnoklassnikki</strong> #f69324</p>\n<p><strong>Orange</strong> #ff6600</p>\n<p><strong>Paypal</strong> #13487b</p>\n<p><strong>Persona</strong> #e0742f</p>\n<p><strong>Pinterest</strong> #cb2128</p>\n<p><strong>QQ</strong> #009BD9</p>\n<p><strong>Reddit</strong> #ff5700</p>\n<p><strong>Renren</strong> #005baa</p>\n<p><strong>Salesforce</strong> #219CDF</p>\n<p><strong>Stackexchange</strong> #4ba1d8</p>\n<p><strong>Steam Community</strong> #666666</p>\n<p><strong>Tumblr</strong> #32506d</p>\n<p><strong>Verisign</strong> #0261a2</p>\n<p><strong>Virgilio</strong> #eb6b21</p>\n<p><strong>Vkontakte</strong> #45668e</p>\n<p><strong>Sinaweibo</strong> #bb3e3e</p>\n<p><strong>WordPress</strong> #21759c</p>\n<p><strong>Mailru</strong> #1897e6</p>\n<p><strong>Xing</strong> #007072</p>\n<p><strong>Openid</strong> #f7921c</p>\n<p>Did I miss anything? Add it in the comments and help build this awesome list.</p>\n<style class=\"grvsc-styles\">\n  .grvsc-container {\n    overflow: auto;\n    -webkit-overflow-scrolling: touch;\n    padding-top: 1rem;\n    padding-top: var(--grvsc-padding-top, var(--grvsc-padding-v, 1rem));\n    padding-bottom: 1rem;\n    padding-bottom: var(--grvsc-padding-bottom, var(--grvsc-padding-v, 1rem));\n    border-radius: 8px;\n    border-radius: var(--grvsc-border-radius, 8px);\n    font-feature-settings: normal;\n  }\n  \n  .grvsc-code {\n    display: inline-block;\n    min-width: 100%;\n  }\n  \n  .grvsc-line {\n    display: inline-block;\n    box-sizing: border-box;\n    width: 100%;\n    padding-left: 1.5rem;\n    padding-left: var(--grvsc-padding-left, var(--grvsc-padding-h, 1.5rem));\n    padding-right: 1.5rem;\n    padding-right: var(--grvsc-padding-right, var(--grvsc-padding-h, 1.5rem));\n  }\n  \n  .grvsc-line-highlighted {\n    background-color: var(--grvsc-line-highlighted-background-color, transparent);\n    box-shadow: inset var(--grvsc-line-highlighted-border-width, 4px) 0 0 0 var(--grvsc-line-highlighted-border-color, transparent);\n  }\n  \n</style>","frontmatter":{"title":"Social Media Colors in Hex","author":{"id":"Team LoginRadius","github":"LoginRadius","avatar":null},"date":"February 06, 2015","updated_date":null,"tags":["SocialMedia","Facebook","Google","Color"],"coverImage":{"childImageSharp":{"fluid":{"aspectRatio":1,"src":"/static/fe80482126ca4794c0c2411058451279/e7487/darrylblog1-150x150.webp","srcSet":"/static/fe80482126ca4794c0c2411058451279/e7487/darrylblog1-150x150.webp 150w","sizes":"(max-width: 150px) 100vw, 150px"}}}},"fields":{"authorId":"Team LoginRadius","slug":"/engineering/social-media-colors-hex/"}}},{"node":{"id":"9a5b4f7a-311b-547d-9127-95044c0422ac","html":"<p>W3C stands for the World Wide Web Consortium, a recognized global web standards body. <a href=\"https://en.wikipedia.org/wiki/Tim_Berners-Lee\">Tim Berners-Lee</a> founded this organization and is run by a full-time staff to continue creating and preserving web standards.</p>\n<p>These specifications are then used to direct the creation of code that lives up to those standards by web developers and browsers. They write the rule-book in a nutshell, which helps determine whether our code is well-written or poorly written.</p>\n<p>Let's understand some essential points of W3C validation.</p>\n<h2 id=\"what-is-w3c-validation\" style=\"position:relative;\"><a href=\"#what-is-w3c-validation\" aria-label=\"what is w3c validation permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What is W3C Validation?</h2>\n<p>World Wide Web Consortium (W3C) allows internet users to check HTML and XHTML documents for well-formatted markup. Markup validation is an important step towards ensuring the technical quality of web pages.</p>\n<h2 id=\"why-validate-a-site-on-w3c\" style=\"position:relative;\"><a href=\"#why-validate-a-site-on-w3c\" aria-label=\"why validate a site on w3c permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why Validate a Site on W3C?</h2>\n<p>W3C validation is the process of checking a website's code to determine if it follows the formatting standards. If you fail to validate your website's pages based on <a href=\"https://en.wikipedia.org/wiki/Web_standards\">W3C standards</a>, your website will most likely suffer from errors or poor traffic owing to poor formatting and readability.</p>\n<h3 id=\"1-help-improve-rankings-in-search-engines\" style=\"position:relative;\"><a href=\"#1-help-improve-rankings-in-search-engines\" aria-label=\"1 help improve rankings in search engines permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>1. Help Improve Rankings in Search Engines</h3>\n<p>W3C validation helps you to get better rankings in search engines (SEO). Errors in your code can affect your site's performance and make a big impact on your site's SEO. Search engines check the HTML or XHTML code of your website when searching. </p>\n<p>If they find invalid HTML or XHTML code – meaning code that does not follow the official rules, you might be removed from their indexes. If there is an error on your web page code, robots will stop searching your whole website's content.</p>\n<h3 id=\"2-validation-helps-teach-best-practices\" style=\"position:relative;\"><a href=\"#2-validation-helps-teach-best-practices\" aria-label=\"2 validation helps teach best practices permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>2. Validation Helps Teach Best Practices</h3>\n<p>Having a standards-compliant code is the best practice for web design. It also teaches and encourages best practices for web design. While many veterans have learned to create error-free code and make relatively few validation errors, most beginners make more errors.</p>\n<p>Computer validation checks can help beginners learn from their mistakes.</p>\n<p><em>\"These technologies, which we call \"web standards,\" are carefully designed to deliver the greatest benefits to the greatest number of web users while ensuring the long-term viability of any document published on the web.\"</em> — <code>Web Standards Group</code></p>\n<h3 id=\"3-improved-website-user-experience\" style=\"position:relative;\"><a href=\"#3-improved-website-user-experience\" aria-label=\"3 improved website user experience permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>3. Improved Website User Experience</h3>\n<p>W3C validated websites will be easily accessed by people with modern browsers. Validation improves usability and functionality because your users are less likely to run into errors when displayed on browsers compared to non-validated websites.</p>\n<p>Validation is fully compatible with a wide range of dynamic pages, scripting, active content, and multimedia presentations.</p>\n<p>The website validation process allows website designers to correct formatting errors that impact website performance, and following international standards, the code used in websites is reduced in size while improving efficiency.</p>\n<p>Because of this, web pages are displayed much faster and flow much better compared to websites that have not been validated.</p>\n<h3 id=\"4-make-website-browsers-friendly\" style=\"position:relative;\"><a href=\"#4-make-website-browsers-friendly\" aria-label=\"4 make website browsers friendly permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>4. Make Website Browsers Friendly</h3>\n<p>Making website browsers friendly is one of the biggest reasons why W3C code validation was introduced. Websites that are not validated may display correctly in one browser but not in other browsers. Many websites face cross-browser problems.</p>\n<p>Websites that are not validated may display formatting problems when used in certain browsers. On the other hand, W3C validated websites are displayed without errors regardless of what browser is used.</p>\n<p>There are five major web browsers: Google Chrome, Firefox, Microsoft Edge, and Safari, and usage among them translates to millions of internet users.</p>\n<h3 id=\"5-multiple-device-accessibility\" style=\"position:relative;\"><a href=\"#5-multiple-device-accessibility\" aria-label=\"5 multiple device accessibility permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>5. Multiple Device Accessibility</h3>\n<p>With the recent boom in smartphones and tablets, more people will be accessing the Internet from mobile devices than desktop computers.</p>\n<p>By 2020, mobile commerce will reach <a href=\"https://www.oberlo.com/statistics/mobile-commerce-sales\">$2.91 trillion</a> worldwide, and some sectors are seeing an even higher proportion of mobile traffic, so there is a growing need for website owners to maximize the usability of their websites on new devices.</p>\n<p>Unfortunately, many website owners do not take advantage of this growth and forego W3C validation that makes sure their websites and web pages are mobile-friendly too. If you want your website to be visited by as many users as possible, accessibility should be a big factor.</p>\n<h3 id=\"6-validation-help-for-easy-coding-and-maintenance\" style=\"position:relative;\"><a href=\"#6-validation-help-for-easy-coding-and-maintenance\" aria-label=\"6 validation help for easy coding and maintenance permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>6. Validation Help for Easy Coding and Maintenance</h3>\n<p>Websites or web pages that validate using W3C website validation have code formatted efficiently and are easy to edit, and it helps website owners to create a new page or another new website with similar formatting.</p>\n<p>The validated code used in W3C HTML validation, W3C XHTML validation, or W3C CSS validation can be used in future sites.</p>\n<h3 id=\"7-validation-as-a-debugging-tool\" style=\"position:relative;\"><a href=\"#7-validation-as-a-debugging-tool\" aria-label=\"7 validation as a debugging tool permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>7. Validation as a Debugging Tool</h3>\n<p>Validators tell you where you have errors in your code. If your page isn't displaying as expected, a validator might very well point you to the cause of the display problems.</p>\n<p>Also, an invalid code that may display fine in one document may show stopping errors in another because of the encompassing code.</p>\n<h2 id=\"how-do-youvalidate-your-code\" style=\"position:relative;\"><a href=\"#how-do-youvalidate-your-code\" aria-label=\"how do youvalidate your code permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>How Do You Validate Your Code?</h2>\n<p>Validation is comparing your code to W3C standards. The best way to validate your code is by using the W3C validation tools.</p>\n<ul>\n<li><a href=\"http://validator.w3.org/\">HTML validator</a></li>\n<li><a href=\"http://jigsaw.w3.org/css-validator/\">CSS validator</a></li>\n</ul>\n<p><strong>HTML Validator:</strong></p>\n<p>This validator checks the markup validity of web documents in HTML, XHTML, SMIL, MathML, etc</p>\n<p><strong>CSS Validator:</strong></p>\n<p>This validator checks the CSS validity of web documents in HTML, XHTML etc.</p>\n<p>There are plenty of browser extensions that will test the page you're viewing against the W3C validators.</p>\n<p>HTML Tidy is another option for validating pages, though it may not offer the exact same results as the W3C validator. One advantage of HTML Tidy is using an extension; you can check your pages directly in the browser without visiting one of the validators sites.</p>\n<h2 id=\"conclusion\" style=\"position:relative;\"><a href=\"#conclusion\" aria-label=\"conclusion permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Conclusion</h2>\n<p>If at all possible, any website should follow W3C validation requirements. It is the right way to do it, but it has many enduring advantages, such as extending the lifespan of the pages, maintaining browser stability, and much more. This will help you understand why W3C is necessary to test all our websites for W3C validation before calling a project complete.</p>\n<style class=\"grvsc-styles\">\n  .grvsc-container {\n    overflow: auto;\n    -webkit-overflow-scrolling: touch;\n    padding-top: 1rem;\n    padding-top: var(--grvsc-padding-top, var(--grvsc-padding-v, 1rem));\n    padding-bottom: 1rem;\n    padding-bottom: var(--grvsc-padding-bottom, var(--grvsc-padding-v, 1rem));\n    border-radius: 8px;\n    border-radius: var(--grvsc-border-radius, 8px);\n    font-feature-settings: normal;\n  }\n  \n  .grvsc-code {\n    display: inline-block;\n    min-width: 100%;\n  }\n  \n  .grvsc-line {\n    display: inline-block;\n    box-sizing: border-box;\n    width: 100%;\n    padding-left: 1.5rem;\n    padding-left: var(--grvsc-padding-left, var(--grvsc-padding-h, 1.5rem));\n    padding-right: 1.5rem;\n    padding-right: var(--grvsc-padding-right, var(--grvsc-padding-h, 1.5rem));\n  }\n  \n  .grvsc-line-highlighted {\n    background-color: var(--grvsc-line-highlighted-background-color, transparent);\n    box-shadow: inset var(--grvsc-line-highlighted-border-width, 4px) 0 0 0 var(--grvsc-line-highlighted-border-color, transparent);\n  }\n  \n</style>","frontmatter":{"title":"W3C Validation: What is it and why to use it?","author":{"id":"Team LoginRadius","github":"LoginRadius","avatar":null},"date":"January 26, 2015","updated_date":null,"tags":["W3C","Validation"],"coverImage":{"childImageSharp":{"fluid":{"aspectRatio":1.5037593984962405,"src":"/static/61a5831ae676536f6f686f26efd47eea/58556/w3c.webp","srcSet":"/static/61a5831ae676536f6f686f26efd47eea/61e93/w3c.webp 200w,\n/static/61a5831ae676536f6f686f26efd47eea/1f5c5/w3c.webp 400w,\n/static/61a5831ae676536f6f686f26efd47eea/58556/w3c.webp 800w,\n/static/61a5831ae676536f6f686f26efd47eea/99238/w3c.webp 1200w","sizes":"(max-width: 800px) 100vw, 800px"}}}},"fields":{"authorId":"Team LoginRadius","slug":"/engineering/w3c-validation/"}}},{"node":{"id":"f2bb40e0-d93e-545d-b9ca-c70a37316cd6","html":"<p>Welcome to our new initiative to contribute and spread the learnings/findings we had working with <a href=\"https://docs.loginradius.com/api\">LoginRadius API</a>!</p>\n<p>We always try to come up with new ideas/process during our development and research sessions..sometimes they are funny but awesome. <strong>:)</strong>. We'll share those ideas and experiences.look forward for your comments/feedback!</p>\n<p>--</p>\n<p>LoginRadius Engineering team</p>\n<style class=\"grvsc-styles\">\n  .grvsc-container {\n    overflow: auto;\n    -webkit-overflow-scrolling: touch;\n    padding-top: 1rem;\n    padding-top: var(--grvsc-padding-top, var(--grvsc-padding-v, 1rem));\n    padding-bottom: 1rem;\n    padding-bottom: var(--grvsc-padding-bottom, var(--grvsc-padding-v, 1rem));\n    border-radius: 8px;\n    border-radius: var(--grvsc-border-radius, 8px);\n    font-feature-settings: normal;\n  }\n  \n  .grvsc-code {\n    display: inline-block;\n    min-width: 100%;\n  }\n  \n  .grvsc-line {\n    display: inline-block;\n    box-sizing: border-box;\n    width: 100%;\n    padding-left: 1.5rem;\n    padding-left: var(--grvsc-padding-left, var(--grvsc-padding-h, 1.5rem));\n    padding-right: 1.5rem;\n    padding-right: var(--grvsc-padding-right, var(--grvsc-padding-h, 1.5rem));\n  }\n  \n  .grvsc-line-highlighted {\n    background-color: var(--grvsc-line-highlighted-background-color, transparent);\n    box-shadow: inset var(--grvsc-line-highlighted-border-width, 4px) 0 0 0 var(--grvsc-line-highlighted-border-color, transparent);\n  }\n  \n</style>","frontmatter":{"title":"Hello developers and designers!","author":{"id":"Team LoginRadius","github":"LoginRadius","avatar":null},"date":"May 02, 2014","updated_date":null,"tags":["Engineering"],"coverImage":{"childImageSharp":{"fluid":{"aspectRatio":1,"src":"/static/b965f64c315a9fddcd7037c0d1e1441f/ad85c/desdev.webp","srcSet":"/static/b965f64c315a9fddcd7037c0d1e1441f/61e93/desdev.webp 200w,\n/static/b965f64c315a9fddcd7037c0d1e1441f/1f5c5/desdev.webp 400w,\n/static/b965f64c315a9fddcd7037c0d1e1441f/ad85c/desdev.webp 600w","sizes":"(max-width: 600px) 100vw, 600px"}}}},"fields":{"authorId":"Team LoginRadius","slug":"/engineering/hello-developers-and-designers/"}}}]},"authorYaml":{"id":"Team LoginRadius","bio":"LoginRadius is a leading provider of cloud-based Customer Identity and Access Management (cIAM) platform.","github":"LoginRadius","stackoverflow":null,"linkedin":null,"medium":null,"twitter":null,"avatar":null}},"pageContext":{"id":"Team LoginRadius","__params":{"id":"team-login-radius"}}},"staticQueryHashes":["1171199041","1384082988","2100481360","23180105","528864852"]}