How to Configure Viewport for Mobile-friendly Design

SEO Jan 30, 2021 5 min read

Share Article

How to Configure Viewport for Mobile-friendly Design
Having a mobile-friendly design is the top important basis for any successful website, but are you sure that your site is fit correctly on all mobile devices. That’s the main reason of configure viewport, to let you control the width of your page and scaling on different devices. Without a viewport, mobile devices will render the page at a typical desktop screen width, scaled to fit the screen.

What is the Meta viewport?

The viewport meta tag is a way to let website owners control, how their pages will display in the visitor’s browser with many instructions like size, scale, and zoom of the page. Meta viewport should be placed in the head of HTML page like most of all other meta tags. Meta viewport

How to Configure Viewport for Proper Mobile-friendly Design?

As we mentioned above, a meta viewport should be included at the head of your page, it’s a small piece of tax code that will increase your website’s mobile usability if you configure it correctly. Here is the best meta viewport configurations that fit for most websites.
<meta name=viewport content="width=device-width, initial-scale=1">
Lets clean the meaning of above property attributes code:
  • content=width=device-width: It gives instruction to the browser to match the screen width in mobile device, which lead to match different screen sizes for any mobile devices.
  • initial-scale=1: The initial zoom when visiting the page, where a value of 1.0 means no zoom.

Other Accessibility Considerations

  • minimum-scale, maximum-scale, user-scalable: NO, NO, and NO (set the minimum and maximum zoom, or disable the user’s ability to zoom) Meta viewport has many options to let you control your page layout, but you should avoid these property attributes because it negatively impact accessibility and potentially reduce users experience.
  • Don’t give content width any number values rather than “device-width”, because if you made the width 320 as an example, your pages will display correctly only on devices with 320 pixels width and will be smaller on larger screen devices and larger on smaller screen devices. Which will force the visitor to zoom in or out to see the page correctly.
Accessibility Considerations

How to Implement Meta Viewport in WordPress Themes?

To implement and configure viewport in your site, just Open wordpress dashboard then go to Appearance->Editor->Header.php, then place meta viewport tag just after the head section.
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
Implement Meta Viewport in WordPressAlso, don’t forget to check your website mobile-friendliness with Google mobile page test to be sure that everything has been set correctly. google mobile-friendly test

To sum it up …

Using meta viewport tag is the main key to getting responsive web design and perfect mobile-friendly website optimization. The Benefits of configuring a viewport are widely used to increase visitors’ pleasure while they browse your site on their mobile devices. So, don’t waste this amazing tag on your mobile optimization strategy.

Common questions about How to Configure Viewport for Mobile-friendly Design

What is the viewport and why is it important for mobile design?

The viewport is the user’s visible area of a web page. Configuring it correctly for mobile devices is crucial because it tells browsers how to control the page’s dimensions and scaling, ensuring content fits and is readable on different screen sizes without horizontal scrolling.

How do I configure the viewport for responsive design?

You configure the viewport using the `meta` tag within the `` section of your HTML document. The most common configuration is ``.

What does `width=device-width` in the viewport tag mean?

`width=device-width` sets the width of the viewport to the width of the device’s screen in CSS pixels. This ensures that the webpage scales correctly to fit the device’s width.

What does `initial-scale=1.0` in the viewport tag mean?

`initial-scale=1.0` sets the initial zoom level when the page is first loaded by the browser. A value of 1.0 means the page will be displayed at a 1:1 scale, preventing it from being zoomed in or out by default.

Are there other properties I can use in the viewport meta tag?

Yes, other properties include `minimum-scale`, `maximum-scale`, and `user-scalable`. However, `user-scalable=no` and restricting scale are generally discouraged as they harm accessibility.

Why is setting `user-scalable=no` often discouraged?

Setting `user-scalable=no` prevents users from pinching to zoom on a webpage. This is generally discouraged because it negatively impacts accessibility for users who need to zoom to read content.

Where exactly should the viewport meta tag be placed in my HTML?

The viewport meta tag must be placed within the `` section of your HTML document, typically after the `` tag.</div> </details><details> <summary><h4>Does the viewport meta tag alone make a site mobile-friendly?</h4></summary><div>No, the viewport meta tag is a foundational step but does not solely make a site mobile-friendly. It must be used in conjunction with CSS techniques like media queries, flexible grids, and responsive images to create a truly responsive design.</div> </details><details> <summary><h4>How can I test if my viewport is configured correctly?</h4></summary><div>You can test your viewport configuration by using browser developer tools to simulate different mobile devices or by using online tools like Google’s Mobile-Friendly Test.</div> </details><details> <summary><h4>Why is configuring the viewport important for SEO?</h4></summary><div>Search engines like Google use mobile-friendliness as a ranking signal. A correctly configured viewport, combined with a responsive design, ensures a good user experience on mobile, which is favored by search algorithms.</div> </details><details> <summary><h4>What is the impact of not setting a viewport meta tag?</h4></summary><div>Without a viewport meta tag, mobile browsers will often render the page at a default desktop width (e.g., 980px) and then shrink it to fit the screen. This results in tiny text and elements, requiring users to zoom and scroll horizontally.</div> </details><details> <summary><h4>Can I use different viewport settings for different pages?</h4></summary><div>Yes, the viewport meta tag is set per HTML page. While the common `width=device-width, initial-scale=1.0` is suitable for most responsive designs, you can theoretically customize it per page if a specific design requires it, though consistency is generally recommended.</div> </details></div></div><div class="pt-8 border-t border-gray-100"><h4 class="text-lg font-bold text-brandDark mb-4 flex items-center gap-2"> <i class="fa-solid fa-tags text-brandOrange"></i> Article Tags</h4><div class="flex flex-wrap gap-2"> <a href=https://topseotut.com/tag/configure-viewport/ class="inline-block px-4 py-2 bg-gray-50 hover:bg-brandBlue hover:text-white hover:border-brandBlue text-brandDark/70 font-medium rounded-lg text-sm transition-all border border-gray-200"> #Configure Viewport </a> <a href=https://topseotut.com/tag/mobile-friendly-design/ class="inline-block px-4 py-2 bg-gray-50 hover:bg-brandBlue hover:text-white hover:border-brandBlue text-brandDark/70 font-medium rounded-lg text-sm transition-all border border-gray-200"> #Mobile-friendly Design </a></div></div><div class="mt-12 bg-gradient-to-br from-gray-50 to-white border border-gray-100 rounded-2xl p-6 md:p-8 flex flex-col md:flex-row items-center md:items-start gap-6 relative overflow-hidden shadow-sm"><div class="absolute left-0 top-0 w-1.5 h-full bg-brandBlue rounded-l-2xl"></div><div class="w-20 h-20 md:w-24 md:h-24 shrink-0 rounded-full bg-brandBlue/5 border border-brandBlue/10 flex items-center justify-center relative"> <i class="fa-solid fa-code text-3xl text-brandBlue"></i><div class="absolute bottom-0 right-0 w-6 h-6 bg-green-500 text-white rounded-full flex items-center justify-center border-2 border-white shadow-sm" title="Verified Author"> <i class="fa-solid fa-check text-[10px]"></i></div></div><div class="text-center md:text-left flex-1"><h4 class="text-xl md:text-2xl font-bold text-brandDark mb-2"> Written by: TopSeoTut Engineering</h4><p class="text-brandDark/70 text-sm md:text-base leading-relaxed mb-4"> A dedicated team of senior software engineers and technical SEO experts. Every article is peer-reviewed and field-tested to ensure maximum accuracy and actionable insights for modern enterprise architectures.</p><div class="flex flex-wrap items-center justify-center md:justify-start gap-4 text-sm font-bold text-brandDark"> <span class="flex items-center gap-1.5 px-3 py-1 bg-white border border-gray-100 rounded-md"><i class="fa-solid fa-briefcase text-brandOrange"></i> 10+ Years Experience</span> <span class="flex items-center gap-1.5 px-3 py-1 bg-white border border-gray-100 rounded-md"><i class="fa-solid fa-shield-halved text-brandBlue"></i> Technically Verified</span></div></div></div></article><nav class="bg-white rounded-2xl shadow-sm border border-gray-100 px-6 py-8 flex flex-col md:flex-row items-center justify-between gap-6 text-sm font-medium leading-relaxed mb-10"><div class="flex-1 text-left w-full"> <span class="block text-brandDark/50 text-xs font-bold uppercase tracking-wider mb-2">Previous Article</span> <a href=https://topseotut.com/best-newsletter-plugins-for-wordpress/ class="text-brandDark hover:text-brandBlue transition-colors flex items-center gap-3 group font-bold text-lg"> <i class="fa-solid fa-arrow-left text-sm text-brandBlue group-hover:-translate-x-1 transition-transform"></i> <span class=line-clamp-2>7 Best Newsletter Plugins for WordPress</span> </a></div><div class="hidden md:block w-px h-16 bg-gray-100 mx-4"></div><hr class="w-full md:hidden border-gray-100"><div class="flex-1 text-right w-full flex flex-col items-end"> <span class="block text-brandDark/50 text-xs font-bold uppercase tracking-wider mb-2">Next Article</span> <a href=https://topseotut.com/follow-google-webmaster-guidelines/ class="text-brandDark hover:text-brandOrange transition-colors flex items-center justify-end gap-3 group font-bold text-lg text-right"> <span class=line-clamp-2>10 Rules to Follow Google Webmaster Guidelines</span> <i class="fa-solid fa-arrow-right text-sm text-brandOrange group-hover:translate-x-1 transition-transform"></i> </a></div></nav></div><aside class="hidden lg:block lg:col-span-4"><div class="bg-white rounded-3xl shadow-sm border border-gray-100 p-8 sticky top-28 space-y-8"><div><h3 class="text-lg font-bold text-brandDark mb-5 flex items-center gap-3"> <i class="fa-solid fa-share-nodes text-brandBlue"></i> Share Article</h3><div class="flex items-center gap-3"> <a href="https://twitter.com/intent/tweet?text=How+to+Configure+Viewport+for+Mobile-friendly+Design&url=https%3A%2F%2Ftopseotut.com%2Fhow-to-configure-viewport-for-mobile-friendly-design%2F" target=_blank class="w-10 h-10 rounded-xl bg-gray-50 border border-gray-200 hover:bg-[#1DA1F2] hover:text-white hover:border-[#1DA1F2] text-brandDark/60 flex items-center justify-center transition-all" title=Twitter> <i class="fa-brands fa-twitter"></i> </a> <a href="https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Ftopseotut.com%2Fhow-to-configure-viewport-for-mobile-friendly-design%2F" target=_blank class="w-10 h-10 rounded-xl bg-gray-50 border border-gray-200 hover:bg-[#4267B2] hover:text-white hover:border-[#4267B2] text-brandDark/60 flex items-center justify-center transition-all" title=Facebook> <i class="fa-brands fa-facebook-f"></i> </a> <a href="https://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Ftopseotut.com%2Fhow-to-configure-viewport-for-mobile-friendly-design%2F" target=_blank class="w-10 h-10 rounded-xl bg-gray-50 border border-gray-200 hover:bg-[#0077b5] hover:text-white hover:border-[#0077b5] text-brandDark/60 flex items-center justify-center transition-all" title=LinkedIn> <i class="fa-brands fa-linkedin-in text-lg"></i> </a> <a href="https://wa.me/?text=How+to+Configure+Viewport+for+Mobile-friendly+Design+https%3A%2F%2Ftopseotut.com%2Fhow-to-configure-viewport-for-mobile-friendly-design%2F" target=_blank class="w-10 h-10 rounded-xl bg-gray-50 border border-gray-200 hover:bg-[#25D366] hover:text-white hover:border-[#25D366] text-brandDark/60 flex items-center justify-center transition-all" title=WhatsApp> <i class="fa-brands fa-whatsapp text-lg"></i> </a> <button onclick="copyPostLink(this, 'https://topseotut.com/how-to-configure-viewport-for-mobile-friendly-design/')" class="w-10 h-10 rounded-xl bg-gray-50 border border-gray-200 hover:bg-gray-200 hover:text-brandOrange text-brandDark/60 flex items-center justify-center transition-all relative group" title="Copy Link"> <i class="fa-regular fa-copy"></i> <span class="copy-feedback absolute -top-8 bg-brandDark text-white text-[10px] px-2 py-1 rounded opacity-0 transition-opacity whitespace-nowrap pointer-events-none">Copied!</span> </button></div></div><hr class=border-gray-100><div><h3 class="text-lg font-bold text-brandDark mb-5 flex items-center gap-3"> <i class="fa-solid fa-layer-group text-brandOrange"></i> Related Articles</h3><div class=space-y-5> <a href=https://topseotut.com/what-are-heading-tags-and-how-to-use-them/ class="flex gap-4 group items-center"><div class="w-20 h-20 rounded-xl overflow-hidden flex-shrink-0 relative border border-gray-100"> <img src=https://topseotut.com/wp-content/uploads/2015/07/heading-tags-150x150.jpg class="w-full h-full object-cover group-hover:scale-110 transition-transform duration-500" alt="What Are Heading Tags and How to Use Them"></div><div class=flex-1><h4 class="text-sm font-bold text-brandDark group-hover:text-brandBlue transition-colors line-clamp-2 mb-1.5 leading-snug"> What Are Heading Tags and How to Use Them</h4> <span class="text-xs text-brandDark/50 font-medium flex items-center gap-1.5"> <i class="fa-regular fa-calendar text-brandBlue"></i> Oct 16, 2020 </span></div> </a> <a href=https://topseotut.com/best-ways-to-increase-organic-traffic/ class="flex gap-4 group items-center"><div class="w-20 h-20 rounded-xl overflow-hidden flex-shrink-0 relative border border-gray-100"> <img src=https://topseotut.com/wp-content/uploads/2015/07/Increase-Organic-Traffic-150x150.jpg class="w-full h-full object-cover group-hover:scale-110 transition-transform duration-500" alt="5 Best Ways to Increase Organic Traffic"></div><div class=flex-1><h4 class="text-sm font-bold text-brandDark group-hover:text-brandBlue transition-colors line-clamp-2 mb-1.5 leading-snug"> 5 Best Ways to Increase Organic Traffic</h4> <span class="text-xs text-brandDark/50 font-medium flex items-center gap-1.5"> <i class="fa-regular fa-calendar text-brandBlue"></i> Nov 20, 2020 </span></div> </a> <a href=https://topseotut.com/10-best-title-tag-optimization-guide-for-better-seo/ class="flex gap-4 group items-center"><div class="w-20 h-20 rounded-xl overflow-hidden flex-shrink-0 relative border border-gray-100"> <img src=https://topseotut.com/wp-content/uploads/2015/06/Best-Title-Tag-Optimization-150x150.jpg class="w-full h-full object-cover group-hover:scale-110 transition-transform duration-500" alt="10 Best Title Tag Optimization Guide for Better SEO"></div><div class=flex-1><h4 class="text-sm font-bold text-brandDark group-hover:text-brandBlue transition-colors line-clamp-2 mb-1.5 leading-snug"> 10 Best Title Tag Optimization Guide for Better SEO</h4> <span class="text-xs text-brandDark/50 font-medium flex items-center gap-1.5"> <i class="fa-regular fa-calendar text-brandBlue"></i> Jan 25, 2020 </span></div> </a></div></div><hr class=border-gray-100><div><h3 class="text-lg font-bold text-brandDark mb-5 flex items-center gap-3"> <i class="fa-solid fa-tags text-brandBlue"></i> Popular Tags</h3><div class="flex flex-wrap gap-2"> <a href=https://topseotut.com/tag/mobile-friendly-design/ class="inline-block px-3 py-1.5 bg-gray-50 hover:bg-brandBlue hover:text-white hover:border-brandBlue text-brandDark/70 font-medium rounded-lg text-sm transition-all border border-gray-200">Mobile-friendly Design</a><a href=https://topseotut.com/tag/configure-viewport/ class="inline-block px-3 py-1.5 bg-gray-50 hover:bg-brandBlue hover:text-white hover:border-brandBlue text-brandDark/70 font-medium rounded-lg text-sm transition-all border border-gray-200">Configure Viewport</a></div></div><hr class=border-gray-100><div class="text-center bg-brandDark p-8 rounded-2xl shadow-sm relative overflow-hidden text-white"><div class="absolute top-0 right-0 w-32 h-32 bg-brandOrange/20 blur-2xl rounded-full -z-10 translate-x-1/2 -translate-y-1/2"></div><div class="absolute bottom-0 left-0 w-32 h-32 bg-brandBlue/20 blur-2xl rounded-full -z-10 -translate-x-1/2 translate-y-1/2"></div><div class="w-16 h-16 rounded-2xl bg-white/10 backdrop-blur-sm border border-white/20 text-white flex items-center justify-center text-2xl mx-auto mb-5"> <i class="fa-solid fa-rocket text-brandOrange"></i></div><h3 class="text-xl font-bold mb-3">Ready to Scale?</h3><p class="text-white/70 text-sm mb-8 leading-relaxed">Stop letting technical debt slow down your growth. Our engineers are ready to build your next big solution.</p> <a href=https://topseotut.com/contact/ class="block w-full bg-brandBlue text-white hover:bg-brandOrange py-3.5 rounded-xl font-bold transition-colors shadow-md"> Work With Us </a></div></div></aside></div></div></main><style>/* Premium List Styling for Single Post */ .single-post-content ul, .single-post-content ol { padding-left: 0; list-style: none !important; } .single-post-content ul > li { position: relative; padding-left: 2.25rem !important; margin-bottom: 1.25rem; line-height: 1.7; } .single-post-content ul > li::before { content: "\f00c"; /* check icon */ font-family: "Font Awesome 6 Free"; font-weight: 900; position: absolute; left: 0; top: 0.25rem; color: #3b82f6; background: rgba(59, 130, 246, 0.1); width: 1.25rem; height: 1.25rem; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.65rem; } .single-post-content ol { counter-reset: premium-counter; } .single-post-content ol > li { position: relative; padding-left: 2.5rem !important; margin-bottom: 1.25rem; line-height: 1.7; counter-increment: premium-counter; } .single-post-content ol > li::before { content: counter(premium-counter); position: absolute; left: 0; top: 0.125rem; background: #ea580c; color: white; font-weight: bold; width: 1.5rem; height: 1.5rem; border-radius: 0.35rem; display: flex; align-items: center; justify-content: center; font-size: 0.8rem; } /* Override Typography Heading Sizes */ .single-post-content h2 { font-size: 2.25rem !important; line-height: 1.2 !important; margin-top: 3.5rem; margin-bottom: 1.5rem; font-weight: 900 !important; } .single-post-content h3 { font-size: 1.75rem !important; line-height: 1.3 !important; margin-top: 3rem; margin-bottom: 1.25rem; font-weight: 800 !important; } .single-post-content h4 { font-size: 1.35rem !important; line-height: 1.4 !important; margin-top: 2rem; margin-bottom: 1rem; font-weight: 800 !important; } @media (max-width: 768px) { .single-post-content h2 { font-size: 1.875rem !important; margin-top: 2.5rem; } .single-post-content h3 { font-size: 1.5rem !important; margin-top: 2rem; } .single-post-content h4 { font-size: 1.25rem !important; } }</style> <script>document.addEventListener('DOMContentLoaded', function() { // Smooth Scroll for TOC if any const tocLinks = document.querySelectorAll('.post-toc a[href^="#"]'); tocLinks.forEach(link => { link.addEventListener('click', function(e) { e.preventDefault(); const targetId = this.getAttribute('href'); if(targetId && targetId !== '#') { try { const targetElement = document.querySelector(targetId); if (targetElement) { const headerOffset = 100; const elementPosition = targetElement.getBoundingClientRect().top; const offsetPosition = elementPosition + window.pageYOffset - headerOffset; window.scrollTo({ top: offsetPosition, behavior: 'smooth' }); } } catch(err) { console.log("Invalid selector", err); } } }); }); }); function copyPostLink(btn, url) { if(navigator.clipboard && window.isSecureContext) { navigator.clipboard.writeText(url).then(function() { const feedback = btn.querySelector('.copy-feedback'); feedback.classList.remove('opacity-0'); setTimeout(() => { feedback.classList.add('opacity-0'); }, 2000); }); } else { let textArea = document.createElement("textarea"); textArea.value = url; textArea.style.position = "fixed"; document.body.appendChild(textArea); textArea.focus(); textArea.select(); try { document.execCommand('copy'); const feedback = btn.querySelector('.copy-feedback'); feedback.classList.remove('opacity-0'); setTimeout(() => { feedback.classList.add('opacity-0'); }, 2000); } catch (err) { console.error('Fallback: Oops, unable to copy', err); } document.body.removeChild(textArea); } }</script> <footer class="bg-white border-t border-brandDark/10 pt-16 pb-8"><div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8"><div class="grid grid-cols-1 md:grid-cols-4 gap-12 mb-12"><div class=md:col-span-1> <a href=https://topseotut.com/ class="group flex items-center gap-3 mb-4"><div class="relative flex items-center justify-center w-11 h-11 rounded-2xl bg-gradient-to-tr from-brandBlue to-brandOrange shadow-md group-hover:shadow-lg group-hover:-translate-y-0.5 transition-all duration-300 overflow-hidden"><div class="absolute inset-[2px] rounded-[14px] bg-white/20 backdrop-blur-md border border-white/30"></div> <i class="fa-solid fa-layer-group text-white text-lg relative z-10 drop-shadow-md"></i></div><div class="flex flex-col"> <span class="text-2xl font-black tracking-tight text-brandDark leading-none mb-0.5"> Top<span class=text-brandBlue>Seo</span><span class=text-brandOrange>Tut</span> </span> <span class="text-[9px] font-bold tracking-[0.25em] text-brandDark/50 uppercase leading-none">Engineered Solutions</span></div> </a><p class="text-sm text-brandDark/70 leading-relaxed mb-6">Transforming complex challenges into scalable, high-performance digital solutions.</p></div><div><h4 class="font-bold text-brandDark mb-4">Services</h4><ul class=space-y-3> <li><a href=# class="text-sm text-brandDark/70 hover:text-brandBlue transition-colors">Enterprise SEO</a></li> <li><a href=# class="text-sm text-brandDark/70 hover:text-brandBlue transition-colors">Custom Software</a></li> <li><a href=# class="text-sm text-brandDark/70 hover:text-brandBlue transition-colors">DevOps Engineering</a></li> <li><a href=# class="text-sm text-brandDark/70 hover:text-brandBlue transition-colors">Cloud Integration</a></li> <li><a href=# class="text-sm text-brandDark/70 hover:text-brandBlue transition-colors">Mobile Applications</a></li></ul></div><div><h4 class="font-bold text-brandDark mb-4">Company</h4><ul id=menu-footer class="space-y-3 m-0 p-0 list-none [&_a]:text-sm [&_a]:text-brandDark/70 hover:[&_a]:text-brandBlue [&_a]:transition-colors"><li id=menu-item-721 class="menu-item menu-item-type-taxonomy menu-item-object-category current-post-ancestor current-menu-parent current-post-parent menu-item-721"><a href=https://topseotut.com/seo/ >SEO Specialist</a></li> <li id=menu-item-723 class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-723"><a href=https://topseotut.com/wordpress/ >WordPress Guide</a></li> <li id=menu-item-720 class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-720"><a href=https://topseotut.com/plugins/ >Custom Plugins</a></li> <li id=menu-item-719 class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-719"><a href=https://topseotut.com/make-money-online/ >Make Money Online</a></li> <li id=menu-item-722 class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-722"><a href=https://topseotut.com/socialmedia/ >Social Media Marketing</a></li></ul></div><div><h4 class="font-bold text-brandDark mb-4">Contact Us</h4><ul class="space-y-4 mb-6"> <li class="flex items-center gap-3 text-sm text-brandDark/70"> <i class="fa-solid fa-envelope text-brandBlue w-4"></i> <a href=mailto:support@topseotut.com class="hover:text-brandBlue transition-colors">support@topseotut.com</a> </li> <li class="flex items-center gap-3 text-sm text-brandDark/70"> <i class="fa-brands fa-whatsapp text-brandBlue w-4 text-base"></i> <a href=https://wa.me/201013835487 target=_blank class="hover:text-brandBlue transition-colors">+20 101 383 5487</a> </li> <li class="flex items-center gap-3 text-sm text-brandDark/70"> <i class="fa-solid fa-headset text-brandBlue w-4"></i> <a href=/contact/ class="hover:text-brandBlue transition-colors">24/7 Support</a> </li></ul><div class="flex flex-wrap gap-2"> <a href=https://facebook.com/fastoservers/ target=_blank class="w-8 h-8 rounded bg-brandBlue/10 text-brandBlue flex items-center justify-center hover:bg-brandBlue hover:text-white transition-colors" aria-label=Facebook><i class="fa-brands fa-facebook-f"></i></a> <a href=https://t.me/fastoservers target=_blank class="w-8 h-8 rounded bg-brandBlue/10 text-brandBlue flex items-center justify-center hover:bg-brandBlue hover:text-white transition-colors" aria-label=Telegram><i class="fa-brands fa-telegram"></i></a> <a href=https://wa.me/201013835487 target=_blank class="w-8 h-8 rounded bg-brandBlue/10 text-brandBlue flex items-center justify-center hover:bg-brandBlue hover:text-white transition-colors" aria-label=WhatsApp><i class="fa-brands fa-whatsapp"></i></a></div></div></div><div class="pt-8 border-t border-brandDark/10 text-center md:text-left flex flex-col md:flex-row justify-between items-center gap-4"><p class="text-sm text-brandDark/50">© 2026 TopSeoTut. All rights reserved.</p><div class="flex flex-wrap justify-center items-center gap-6"><ul id=menu-official class="flex flex-wrap justify-center items-center gap-6 m-0 p-0 list-none [&_a]:text-sm [&_a]:text-brandDark/50 hover:[&_a]:text-brandBlue [&_a]:transition-colors"><li id=menu-item-692 class="menu-item menu-item-type-post_type menu-item-object-page menu-item-692"><a href=https://topseotut.com/about/ >About</a></li> <li id=menu-item-693 class="menu-item menu-item-type-post_type menu-item-object-page menu-item-693"><a href=https://topseotut.com/contact/ >Contact</a></li> <li id=menu-item-695 class="menu-item menu-item-type-post_type menu-item-object-page menu-item-695"><a href=https://topseotut.com/terms/ >Terms</a></li> <li id=menu-item-694 class="menu-item menu-item-type-post_type menu-item-object-page menu-item-694"><a href=https://topseotut.com/privacy-policy/ >Privacy Policy</a></li></ul></div></div></div></footer><div id=floating-actions class="fixed bottom-6 right-6 z-50 hidden md:flex flex-col gap-3 transition-all duration-500 opacity-0 translate-y-10 invisible"> <a href=https://wa.me/201013835487 target=_blank class="w-11 h-11 bg-white text-[#25D366] rounded-full shadow-lg flex items-center justify-center transition-all duration-300 hover:bg-[#25D366] hover:text-white hover:-translate-y-1 group relative ring-1 ring-black/5"> <i class="fa-brands fa-whatsapp text-xl transition-transform duration-300 group-hover:scale-110"></i> </a> <button id=to-top-trigger class="w-11 h-11 bg-brandBlue text-white rounded-full shadow-lg flex items-center justify-center transition-all duration-300 hover:bg-brandDark hover:-translate-y-1 group relative ring-1 ring-black/5 outline-none"> <i class="fa-solid fa-arrow-up text-sm transition-transform duration-300 group-hover:-translate-y-1"></i> </button></div> <script src=https://unpkg.com/aos@2.3.1/dist/aos.js></script> <script>AOS.init({ once: true, offset: 50, duration: 800 }); document.addEventListener('DOMContentLoaded', () => { const floatingWrapper = document.getElementById('floating-actions'); const scrollTrigger = document.getElementById('to-top-trigger'); if(floatingWrapper && scrollTrigger) { window.addEventListener('scroll', () => { if (window.scrollY > 300) { floatingWrapper.classList.remove('opacity-0', 'translate-y-10', 'invisible'); } else { floatingWrapper.classList.add('opacity-0', 'translate-y-10', 'invisible'); } }); scrollTrigger.addEventListener('click', () => { window.scrollTo({ top: 0, behavior: 'smooth' }); }); } });</script> <div class="fixed bottom-0 left-0 w-full z-[90] bg-white border-t border-brandDark/10 shadow-[0_-4px_20px_rgba(0,0,0,0.08)] md:hidden"><div class="flex h-14"> <a href=https://wa.me/201013835487 target=_blank rel=nofollow class="flex-1 flex items-center justify-center gap-2 bg-[#25D366] text-white font-bold text-[15px] active:bg-[#128C7E] transition-colors border-r border-white/20"> <i class="fab fa-whatsapp text-[1.2rem]"></i> WhatsApp </a> <button id=chatbot-mobile-btn class="flex-1 flex items-center justify-center gap-2 bg-brandOrange text-white font-bold text-[15px] active:bg-brandOrangeHover transition-colors border-l border-white/20"> <i class="fas fa-headset text-[1.1rem]"></i> Chat with us </button></div></div> <button id=chatbot-fab class="hidden md:flex fixed bottom-6 right-6 w-11 h-11 bg-brandOrange text-white rounded-full shadow-lg items-center justify-center transition-all duration-500 ease-in-out z-50 hover:-translate-y-1 ring-1 ring-black/5 border-2 border-brandOrange hover:bg-white hover:text-brandOrange"> <i class="fas fa-comment-dots text-[1.1rem]"></i> </button><div id=chatbot-window class="fixed bg-white rounded-3xl shadow-[0_8px_30px_rgba(0,0,0,0.12)] border border-gray-100 flex flex-col z-50 hidden overflow-hidden chat-window-hidden"><div class="bg-brandDark text-white p-4 flex justify-between items-center"><h3 class="font-bold text-lg flex items-center gap-2"><i class="fas fa-headset text-brandOrange"></i> Chat with Sammax</h3> <button id=chatbot-close class="text-gray-300 hover:text-white transition-colors"> <i class="fas fa-times text-xl"></i> </button></div><div id=chatbot-messages class="flex-1 p-4 overflow-y-auto flex flex-col gap-3 bg-gray-50"><div class="flex items-start gap-2 max-w-[85%] self-start"><div class="w-8 h-8 rounded-full bg-brandDark flex items-center justify-center flex-shrink-0 text-white text-xs"> <i class="fas fa-headset"></i></div><div class="bg-white border border-gray-100 text-gray-700 text-sm p-3 rounded-2xl rounded-tr-sm shadow-[0_2px_8px_rgba(0,0,0,0.04)]"> Welcome to TopSeoTut! I'm Sammax, how can I help you today?</div></div></div><div class="p-3 border-t border-gray-100 bg-white"><form id=chatbot-form class="flex gap-2 relative"> <input type=text id=chatbot-input placeholder="Type your message here..." class="flex-1 min-w-0 border border-gray-200 rounded-full px-4 py-2 text-sm focus:outline-none focus:border-brandOrange focus:ring-1 focus:ring-brandOrange bg-gray-50 transition-all text-gray-700" required autocomplete=off> <button type=submit class="w-10 h-10 rounded-full bg-brandOrange text-white flex items-center justify-center border-2 border-brandOrange hover:bg-white hover:text-brandOrange transition-colors flex-shrink-0"> <i class="fas fa-paper-plane text-sm rtl:-scale-x-100"></i> </button></form></div></div><style>#chatbot-window { transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1), transform 0.4s cubic-bezier(0.16, 1, 0.3, 1); transform-origin: bottom right; bottom: 64px; right: 16px; left: 16px; width: auto; max-height: calc(100vh - 80px); } #chatbot-messages { max-height: calc(100vh - 180px); } @media (min-width: 768px) { #chatbot-window { bottom: 80px; right: 24px; left: auto; width: 384px; } #chatbot-messages { height: 350px; max-height: none; } } .chat-window-hidden { opacity: 0 !important; transform: translateY(20px) scale(0.95) !important; pointer-events: none; } .chat-window-visible { opacity: 1 !important; transform: translateY(0) scale(1) !important; pointer-events: auto; }</style> <script>document.addEventListener("DOMContentLoaded", function() { const fab = document.getElementById('chatbot-fab'); const windowEl = document.getElementById('chatbot-window'); const closeBtn = document.getElementById('chatbot-close'); const form = document.getElementById('chatbot-form'); const input = document.getElementById('chatbot-input'); const messages = document.getElementById('chatbot-messages'); const ajaxUrl = 'https://topseotut.com/wp-admin/admin-ajax.php'; const chatSessionId = 'web_' + Math.random().toString(36).substring(2, 12); // FAB Scroll Animation window.addEventListener('scroll', function() { if (window.pageYOffset > 300) { fab.style.right = '80px'; } else { fab.style.right = '24px'; } }); // Toggle Chat Window function openChat() { if (windowEl.classList.contains('hidden')) { windowEl.classList.remove('hidden'); void windowEl.offsetWidth; windowEl.classList.remove('chat-window-hidden'); windowEl.classList.add('chat-window-visible'); input.focus(); } else { closeChat(); } } fab.addEventListener('click', openChat); const mobileBtn = document.getElementById('chatbot-mobile-btn'); if (mobileBtn) { mobileBtn.addEventListener('click', openChat); } closeBtn.addEventListener('click', closeChat); function closeChat() { windowEl.classList.remove('chat-window-visible'); windowEl.classList.add('chat-window-hidden'); setTimeout(() => windowEl.classList.add('hidden'), 400); } function scrollToBottom() { messages.scrollTop = messages.scrollHeight; } // Handle Form Submit form.addEventListener('submit', function(e) { e.preventDefault(); const message = input.value.trim(); if (!message) return; // Append User Message const userHtml = ` <div class="flex items-start gap-2 max-w-[85%] self-end flex-row-reverse"> <div class="w-8 h-8 rounded-full bg-brandOrange flex items-center justify-center flex-shrink-0 text-white text-xs"> <i class="fas fa-user"></i> </div> <div class="bg-brandOrange text-white text-sm p-3 rounded-2xl rounded-tl-sm shadow-[0_2px_8px_rgba(0,0,0,0.06)]"> ${escapeHtml(message)} </div> </div> `; messages.insertAdjacentHTML('beforeend', userHtml); input.value = ''; scrollToBottom(); // Add Typing Indicator const typingId = 'typing-' + Date.now(); const typingHtml = ` <div id=${typingId} class="flex items-start gap-2 max-w-[85%] self-start"> <div class="w-8 h-8 rounded-full bg-brandDark flex items-center justify-center flex-shrink-0 text-white text-xs"> <i class="fas fa-headset"></i> </div> <div class="bg-white border border-gray-100 text-gray-500 text-sm p-3 rounded-2xl rounded-tr-sm shadow-[0_2px_8px_rgba(0,0,0,0.04)] flex items-center gap-1"> <span class="w-1.5 h-1.5 bg-gray-400 rounded-full animate-bounce"></span> <span class="w-1.5 h-1.5 bg-gray-400 rounded-full animate-bounce" style="animation-delay: 0.2s"></span> <span class="w-1.5 h-1.5 bg-gray-400 rounded-full animate-bounce" style="animation-delay: 0.4s"></span> </div> </div> `; messages.insertAdjacentHTML('beforeend', typingHtml); scrollToBottom(); // Fetch via WordPress AJAX proxy (avoids CORS) fetch(ajaxUrl, { method: 'POST', headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, body: 'action=chatbot_message&message=' + encodeURIComponent(message) + '&session_id=' + encodeURIComponent(chatSessionId) }) .then(response => { if (!response.ok) throw new Error('Network response was not ok'); return response.json(); }) .then(data => { document.getElementById(typingId)?.remove(); const botReply = (data.data && data.data.reply) ? data.data.reply : 'Your message has been received.'; const botHtml = ` <div class="flex items-start gap-2 max-w-[85%] self-start"> <div class="w-8 h-8 rounded-full bg-brandDark flex items-center justify-center flex-shrink-0 text-white text-xs"> <i class="fas fa-headset"></i> </div> <div class="bg-white border border-gray-100 text-gray-700 text-sm p-3 rounded-2xl rounded-tr-sm shadow-[0_2px_8px_rgba(0,0,0,0.04)]"> ${botReply.replace(/\n/g, '<br>')} </div> </div> `; messages.insertAdjacentHTML('beforeend', botHtml); scrollToBottom(); }) .catch(error => { document.getElementById(typingId)?.remove(); const errorHtml = ` <div class="flex items-start gap-2 max-w-[85%] self-start"> <div class="w-8 h-8 rounded-full bg-brandDark flex items-center justify-center flex-shrink-0 text-white text-xs"> <i class="fas fa-headset"></i> </div> <div class="bg-white border border-red-100 text-red-600 text-sm p-3 rounded-2xl rounded-tr-sm shadow-[0_2px_8px_rgba(0,0,0,0.04)]"> Sorry, a connection error occurred. Please try again later. </div> </div> `; messages.insertAdjacentHTML('beforeend', errorHtml); scrollToBottom(); }); }); function escapeHtml(unsafe) { return unsafe .replace(/&/g, "&") .replace(/</g, "<") .replace(/>/g, ">") .replace(/"/g, """) .replace(/'/g, "'"); } });</script> <script type=speculationrules>{"prefetch":[{"source":"document","where":{"and":[{"href_matches":"/*"},{"not":{"href_matches":["/wp-*.php","/wp-admin/*","/wp-content/uploads/*","/wp-content/*","/wp-content/plugins/*","/wp-content/themes/fastoservers/*","/*\\?(.+)"]}},{"not":{"selector_matches":"a[rel~=\"nofollow\"]"}},{"not":{"selector_matches":".no-prefetch, .no-prefetch a"}}]},"eagerness":"conservative"}]}</script> </body></html>