🔷 1. Introduction:
The <body>
tag contains everything visible on a webpage.
To make it look better, HTML provides some special attributes inside the <body>
tag.
These attributes control the background, text color, and link colors on the page.
🔷 2. Definition:
Body tag attributes are used to set the appearance of the webpage’s content.
They are written inside the opening <body>
tag.
🔷 3. Common Attributes of <body>
Tag:
Attribute | Use / Function |
---|---|
background | Sets a background image |
bgcolor | Sets background color |
text | Sets text color |
link | Sets default color of hyperlinks |
alink | Sets color when link is active (clicked) |
vlink | Sets color of visited link |
<body
background="bg.jpg"
bgcolor="#ffe4b5"
text="black"
link="blue"
alink="red"
vlink="green">
<h1>Welcome</h1>
<p>This is my webpage.</p>
<a href="https://example.com">Visit Example</a>
</body>
🔷 5. Output (What appears in browser):
- Background image from
"bg.jpg"
- Page background color: light brown
- Text color: black
- Hyperlink color: blue
- Active link color (when clicked): red
- Visited link color: green
🔷 6. Real Life Example:
A student adds a soft color background (bgcolor="lightblue"
) to their school project page, and sets custom colors for links to match the design.
🔷 7. Practical Notes:
- These attributes are HTML 4.01 based
- In modern HTML, we use CSS instead for better control
- But still useful for basic and quick designs
🔷 8. Advantages:
- Quick design without CSS
- Easy for beginners
- Helps make pages colorful and readable
- Simple to remember and use
🔷 9. Limitations:
- Not supported in HTML5 (deprecated)
- CSS is recommended now
- Less control over layout and styling
IN HINDI
HTML Body टैग के Attributes
(background, bgcolor, text, link, alink, vlink)
🔷 1. परिचय (Introduction):
HTML में <body>
टैग वह भाग होता है जिसमें वेबपेज का सारा दृश्य (visible) कंटेंट होता है।
इस टैग के अंदर कुछ खास attributes दिए जाते हैं, जो पेज का रंग, बैकग्राउंड इमेज, टेक्स्ट और लिंक के रंग को सेट करते हैं।
ये attributes पेज को सुंदर और रंगीन बनाते हैं।
🔷 2. परिभाषा (Definition):
Body टैग के Attributes का उपयोग HTML पेज की दिखावट (appearance) को कंट्रोल करने के लिए किया जाता है।
ये attributes <body>
टैग के अंदर लिखे जाते हैं।
🔷 3. प्रमुख Attributes की सूची:
Attribute | कार्य / उपयोग |
---|---|
background | बैकग्राउंड इमेज लगाने के लिए |
bgcolor | बैकग्राउंड रंग सेट करने के लिए |
text | टेक्स्ट का रंग सेट करने के लिए |
link | नॉर्मल लिंक का रंग सेट करने के लिए |
alink | क्लिक करने पर (active) लिंक का रंग |
vlink | पहले से विज़िट किए लिंक का रंग |
🔷 4. सिंटैक्स + उदाहरण (Code):
<body
background="bg.jpg"
bgcolor="#ffe4b5"
text="black"
link="blue"
alink="red"
vlink="green">
<h1>स्वागत है</h1>
<p>यह मेरी वेबसाइट है।</p>
<a href="https://example.com">Example पर जाएं</a>
</body>
🔷 5. आउटपुट (Output में दिखेगा):
- बैकग्राउंड इमेज –
"bg.jpg"
- पेज का बैकग्राउंड कलर – हल्का भूरा
- टेक्स्ट का रंग – काला
- लिंक का रंग – नीला
- क्लिक होने पर लिंक का रंग – लाल
- विज़िट किए गए लिंक का रंग – हरा
🔷 6. वास्तविक जीवन उदाहरण (Real Life Example):
मान लीजिए एक छात्र अपने स्कूल प्रोजेक्ट के लिए HTML पेज बनाता है।
वह <body bgcolor="lightblue">
लगाकर बैकग्राउंड हल्के नीले रंग का कर देता है और लिंक को नीले, हरे और लाल रंग में सेट करता है।
🔷 7. व्यावहारिक जानकारी (Practical Note):
- ये attributes पुराने HTML वर्जन (HTML 4.01) में उपयोग होते थे।
- अब HTML5 में इनकी जगह CSS का प्रयोग किया जाता है।
- लेकिन शुरुआती अभ्यास और प्रोजेक्ट में ये अब भी उपयोगी हैं।
🔷 8. लाभ (Advantages):
- CSS के बिना भी पेज को रंगीन बनाया जा सकता है
- शुरुआती छात्रों के लिए आसान
- लाइटवेट और जल्दी उपयोग होने वाले attributes
- फॉर्मेटिंग जल्दी और सरल
🔷 9. सीमाएँ (Limitations):
- HTML5 में support नहीं है (deprecated)
- CSS से तुलना करें तो बहुत सीमित विकल्प
- responsive डिजाइन के लिए CSS ज़रूरी है