Which attribute is used to specify alternate text?

नमस्कार दोस्तों। इस लेख में हम आपको आपके सवाल Which attribute is used to specify alternate text? का जवाब दे रहे होंगे।

Which attribute is used to specify alternate text?

HTML में किसी img के साथ alternate text देने के लिए alt attribute का use किया जाता है। इसको आप निचे दिए एक कोड से समझ सकते है।

<img src="example.jpg" alt="A description of the image" width="500" height="300">

Example:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Example of Alt Text</title>
</head>
<body>

    <h1>Welcome to My Website</h1>

    <!-- Image with alternate text specified -->
    <img src="beautiful-landscape.jpg" alt="A beautiful mountain landscape with a clear blue sky and green fields" width="600" height="400">

    <p>This image shows a scenic view of nature with mountains, a clear sky, and green fields.</p>

</body>
</html>

alt attribute का use क्यों किया जाता है ?

यह टैग या एट्रिब्यूट इमेज के विवरण होता है जो तब काम आता है जब इंटरनेट slow हो और image load न हो पा रहा हो इस situation में atl में लिखा टेक्स्ट शो होता है जिससे यूजर को यह पता चल जाता है की यह पर कौन सा image है।

How to specify an alternate text for the area, required if the href attribute is present?

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Image Map with Alternate Text</title>
</head>
<body>

    <h1>Clickable Image Map Example</h1>

    <!-- Image with an associated image map -->
    <img src="example.jpg" alt="Example Image with Clickable Areas" usemap="#example-map" width="500" height="300">

    <!-- Define the image map -->
    <map name="example-map">
        <!-- Define a rectangular area with alternate text -->
        <area shape="rect" coords="50,50,200,200" href="https://www.example.com/rectangle" alt="Rectangle Area">
        
        <!-- Define a circular area with alternate text -->
        <area shape="circle" coords="300,150,50" href="https://www.example.com/circle" alt="Circle Area">
        
        <!-- Define a polygonal area with alternate text -->
        <area shape="poly" coords="350,100,400,200,300,250,250,150" href="https://www.example.com/polygon" alt="Polygon Area">
    </map>

</body>
</html>

हम आशा करते है आपको आपके सवाल Which attribute is used to specify alternate text? का जवाब मिल गया होगा। अगर आपके पास कोई और सवाल है तो comment में जरूर बताये।

इसे भी पढ़े:

Leave a comment