HTML - Backgrounds in Hindi




दोस्तों इस chapter में हम HTML backgrounds के बारे में जानेंगे तो चलिए शुरू करते है, HTML में backgrounds का उपयोग किसी भी website या blog को और आकर्षक बनाने के लिए किया जाता है, CSS का उपयोग करके आप अपनी वेबसाइट की body, image, font, heading, या किसी भी element में background color या image को डिफाइन कर सकते हैं।

वेबसाइट को attractive बनाने के लिए website categories के साथ उसके background को भी बदलना पड़ता है, और आपने अक्सर देखा होगा कि कई websites या blog का backgrounds अलग-अलग colors में होता है, आप तो जानते ही होंगे HTML का default background color white होता है, लेकिन अगर आप background में कुछ और color देना चाहते है तो अब background color को change कर सकते हैं।

दोस्तों आइये अब हम backgrounds types के बारे में जानते हैं −

  • Colored Background

  • Image Background

Colored Background

कलर background को HTML में डिफाइन करने के लिए bgcolor attribute का use किया जाता है, but इस attribute का उपयोग HTML5 नहीं किया जाता, दोस्तों bgcolor attribute सभी browser पर work कर सकता है।

Syntax

<element_name bgcolor="color_name">

<element_name background="color_name">

Image Background

दोस्तों Image को website में set करने के लिए HTML में 'background' attribute का use किया जाता है, इस attribute पर color name भी दिया जा सकता है, HTML5 ने इस attribute को हटा दिया है लेकिन अभी भी ये सभी web browser पर काम कर सकता हैं।

Syntax

<element_name background="image_path_or_color_name">

Html में backgrounds color को कैसे डिफाइन करते हैं आइये अब इसका एक उदाहरण देखतें हैं −

Example

<!DOCTYPE html>
<html>
<head>
<style>
h1 {
    background-color: Red;
}

p {
    background-color: Yellow;
}
</style>
</head>
<body>
<h1>This background is Red</h1>
<p>This background is Yellow</p>
</body>
</html>

Result

This background is Red

This background is Yellow