Skip to main content

web font ko repair karne ki technic

 Certainly! Here are different attributes or techniques used in web development and their functionalities:

  1. Swap Attribute (CSS Font Loading API):

    • Functionality: font-display: swap; is a CSS property used with @font-face rules. It tells the browser to use a fallback font until the custom font is downloaded, at which point it swaps to the custom font.
  2. Defer Attribute (Script Loading):

    • Functionality: The defer attribute in the script tag (<script defer src="..."></script>) tells the browser to download the script file while parsing the HTML document. It defers the script execution until the HTML parsing is complete.
  3. Async Attribute (Script Loading):

    • Functionality: Similar to defer, the async attribute (<script async src="..."></script>) also loads external scripts asynchronously while allowing the HTML parsing to continue. However, it doesn't guarantee the order of script execution, which could lead to different behavior compared to defer.
  4. Preload Attribute (Resource Hints):

    • Functionality: <link rel="preload" as="font" href="..."> or <link rel="preload" href="..." as="script"> hints the browser to fetch resources (like fonts, scripts) early in the page load process without executing them immediately, optimizing loading times.
  5. Intersection Observer API:

    • Functionality: It's an API used to detect when an element enters or exits the browser's viewport. It's useful for lazy loading images or triggering events based on elements' visibility.
  6. Media Queries (CSS):

    • Functionality: Media queries (@media screen and (max-width: 768px) { ... }) allow styles to be applied based on specific conditions like screen size, resolution, or device orientation.
  7. Async Functions (JavaScript):

    • Functionality: Async functions in JavaScript (async function myFunction() { ... }) allow writing asynchronous code more easily using async and await keywords, enabling smoother handling of asynchronous tasks.

Each of these techniques or attributes serves different purposes in web development, focusing on aspects like performance optimization, asynchronous loading, responsive design, or improving user experience. They're used based on specific requirements to enhance the functionality and performance of web applications or websites.



Certainly! Here are some additional techniques and functionalities used in web development:

  1. Critical CSS (Above-the-fold Styles):

    • Functionality: Critical CSS refers to the essential CSS required to style the content that appears above the fold (initially visible part) of a webpage. It's optimized and loaded inline or through dedicated techniques to render the crucial content faster.
  2. Service Workers:

    • Functionality: Service workers are scripts that run in the background, separate from web pages, enabling features like caching, push notifications, and offline functionality in web applications.
  3. Lazy Loading (Images, Videos):

    • Functionality: Lazy loading delays the loading of non-critical resources (like images or videos) until they are needed, reducing initial page load time and improving performance. It's achieved through JavaScript or native browser features.
  4. Minification and Compression:

    • Functionality: Minification reduces the size of HTML, CSS, and JavaScript files by removing unnecessary characters (like spaces, comments) to improve load times. Compression (e.g., gzip) further reduces file sizes for faster delivery.
  5. Cache Control (HTTP Headers):

    • Functionality: Setting cache control headers (e.g., Cache-Control, Expires) on server responses allows browsers to cache resources locally, reducing server requests and improving load times for returning visitors.
  6. Responsive Design (Viewport Meta Tag):

    • Functionality: Using the viewport meta tag (<meta name="viewport" content="width=device-width, initial-scale=1.0">) ensures proper scaling and responsiveness on various devices by adjusting the viewport width and initial zoom level.
  7. Progressive Enhancement:

    • Functionality: It's an approach in web development that emphasizes building a basic usable version of a website or web application first and then adding enhanced features for newer browsers or devices.
  8. Content Delivery Networks (CDNs):

    • Functionality: CDNs host website content on distributed servers globally, delivering assets like images, stylesheets, and scripts from the nearest server to the user's location, reducing latency and improving load times.

These techniques and functionalities contribute to various aspects of web development, focusing on performance optimization, user experience, and compatibility across different devices and network conditions. Their usage depends on the specific needs and goals of a web project.


Yahan kuch aur techniques aur functionalities hain jo web development mein istemal hoti hain:

  1. Critical Rendering Path Optimization:

    • Functionality: Ye optimization process hai jo browser ke rendering pipeline ko improve karta hai. Isme HTML, CSS, aur JavaScript ko optimize kiya jata hai taaki web page ko jaldi render kiya ja sake.
  2. Error Handling (JavaScript):

    • Functionality: JavaScript mein error handling techniques, jaise try-catch blocks ya error objects, ka istemal hota hai errors ko manage aur handle karne ke liye, jo ki code ki stability aur security ko maintain karta hai.
  3. Progressive Web Apps (PWAs):

    • Functionality: PWAs combine web and native app functionalities to offer features like offline access, push notifications, and home screen installation, providing a more app-like experience on the web.
  4. Accessibility (A11Y):

    • Functionality: Accessibility techniques focus on making web content usable and navigable for people with disabilities. Techniques include semantic HTML, ARIA roles, and proper use of alt attributes for images.
  5. SEO Optimization:

    • Functionality: Search Engine Optimization techniques involve improving website visibility on search engines. This includes optimizing content, using proper meta tags, creating sitemaps, and ensuring mobile responsiveness.
  6. Session Management and Security:

    • Functionality: Web applications use techniques like session tokens, CSRF protection, and HTTPS to manage user sessions securely, prevent unauthorized access, and protect sensitive user data.
  7. AJAX (Asynchronous JavaScript and XML):

    • Functionality: AJAX enables asynchronous communication between the browser and server, allowing data to be retrieved without reloading the entire page. It's commonly used in dynamic web applications.
  8. ES6+ JavaScript Features:

    • Functionality: Modern JavaScript (ES6+) introduces features like arrow functions, classes, destructuring, and modules, enhancing code readability, maintainability, and performance.

Har ek technique ya functionality specific use case ya development requirement ke hisab se istemal hoti hai. Inka use karke developers user experience, performance, aur security ko optimize karte hain web applications mein.


Ensure text remains visible during webfont load



Font-Display Property (Font ko immediately show karna):

  • font-display CSS property ka use karke aap font ko jaldi show kar sakte hain, jaise ki font-display: swap. Isse text ke sath default fonts use honge jab tak webfonts load nahi hote.


CSS
@font-face { font-family: 'YourFontName'; src: url('path/to/font.woff2') format('woff2'); font-display: swap;
<p>This is a simple HTML code </p>
@font-face { font-family: 'YourFontName'; src: url('path/to/font.woff2') format('woff2'); font-display: swap; }


Inline Critical Fonts (Critical font ko inline karna):

Important text ke liye critical fonts ko inline karke load karein. Ye ensure karta hai ki initial text jaldi show ho.
AAA
<style> @font-face { font-family: 'YourFontName'; src: url('path/to/font.woff2') format('woff2'); } h1, h2, p { font-family: 'YourFontName', sans-serif; } </style>

Font Preloading (Font ko preload karna):
Font ko preload karke browser ke cache mein rakhna, taaki woh jaldi load ho sake jab use kiya jaaye.

<link rel="preload" as="font" href="path/to/font.woff2" crossorigin>

In techniques ka istemal karke aap text ko webfonts load hone mein wait kiye bina bhi visible rakh sakte hain, improving user experience.


Here are a few more techniques to address the "Ensure text remains visible during webfont load" issue:

  1. Font Subset (Font ko subset karna):

    • Sirf zaroori characters ya glyphs ko include karke font file size ko kam kar sakte hain, jisse faster load ho.
  2. Fallback Fonts (Alternative fonts ka istemal):

    • Default fonts ko define karke, jaise ki sans-serif ya serif, jo webfonts load hone se pehle temporary fallback ke roop mein use hote hain.
body {
  font-family: 'YourFont', sans-serif;
}


  1. Font Optimization (Font ka optimization):

    • Font files ko optimize karein taaki unka size kam ho aur faster load ho sake.
  2. Asynchronous Font Loading (Font ko asynchronous tareeke se load karna):

    • JavaScript libraries ka use karke ya font-display: optional property se font ko non-blocking tareeke se load karein.

<link rel="stylesheet" href="path/to/your/font.css" media="print" onload="this.media='all'">


Comments

Popular posts from this blog

Buttons do not have an accessible name photo

 Buttons do not have an accessible name When a button doesn't have an accessible name, screen readers announce it as "button", making it unusable for users who rely on screen readers.  Learn how to make buttons more accessible . Failing Elements div.centered > header.centered-top-container > div.centered-top > button.svg-icon-24-button <button class="svg-icon-24-button hamburger-menu flat-icon-button ripple"> body.version-1-3-3 > aside.sidebar-container > div.navigation > button.svg-icon-24-button <button class="svg-icon-24-button flat-icon-button ripple sidebar-back">