How can I display a div that will only be visible to Internet Explorer users, including IE 11, on my Webflow site? The purpose of this div is to display a message saying "For the best experience, please open using Chrome, Firefox, or Safari. Thanks!"

TL;DR
  • Add a div with the message for IE users in Webflow and assign it the ID "ieMessage."
  • Use a CSS hack within the Custom Code's Head Code section to make the div visible only in IE browsers.
  • Publish and test the site to ensure the message appears correctly in Internet Explorer.

To display a div specifically for Internet Explorer (IE) users, you can use CSS to target IE browsers. This is possible because IE supports certain CSS hacks that other browsers ignore.

1. Create the Div Element

  • Add a div to your Webflow project where you want the message to appear.
  • Set this div’s content to: “For the best experience, please open using Chrome, Firefox, or Safari. Thanks!”

2. Use a CSS Hack for IE

  • Open the Custom Code section of your Webflow site.
  • Navigate to Project Settings > Custom Code and locate the Head Code section.
  • Add the following CSS inside a <style> tag:

  ```css

  <!-- This is an Internet Explorer-specific CSS hack -->

  @media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {

      / Target only Internet Explorer browsers, including IE11 /

      #ieMessage {

          display: block;

      }

  }

  / Hide the div by default for other browsers /

  #ieMessage {

      display: none;

  }

  ```

3. Ensure Proper Element IDs

  • Assign an ID to your newly added div by setting it to "ieMessage". This ensures that the CSS targets the correct element.

4. Publish and Test

  • Publish your site to check that the div only appears in Internet Explorer.
  • Use tools like BrowserStack to verify the div's appearance across different browsers, focusing on Internet Explorer.

Summary

By using a specific CSS hack to target Internet Explorer, you can display a custom message to users of that browser while hiding it on others. Make sure to add your div with the ID "ieMessage" and test it after publishing.

Rate this answer

Other Webflow Questions