Creating Divs with Id style
Div Element
<Div> Tag के साथ निम्न Attribute use किये जाते है
Ex -<Div class="mydiv">
Div का fullform Division है Html मे इस element का use web page को different Divisions या sections मे divide करने के लिए किया जाता है
Div element Basically Other Html Elements के लिए container का का करता है अर्थात इसके अंदर या दे sections मे हम विभिन्न Html element को एक Group मे रख सकते है
Div Block Level Element है और इसे <p> के अंदर उस नही कर सकते है। हम Div के द्वारा create किये गए Divisions या sections और उसमे दिये गए Html element को हम css का उस कर उनकी Formatting करने के साथ उनका Appearance(दिखावाट) set कर सकते है
इसका syntax निम्न है
Syntax
<Div>
Div section
</Div>
Ex
<Div>
<H1>my Heading </H1>
<p> This is my Div Section.
</Div>
<Div> Tag के साथ निम्न Attribute use किये जाते है
Id - इसका use Html Document मे use किये जा रहे प्रत्येक Div को unique Id provide करने के लिए किया जाता है जिसे उसे अलग से पहचाना जा सके और जिससे उसे अलग अलग css rules व javascript code के साथ use किया जा सके।
Ex -<Div id="mydiv">
Class- इसका use div के लिए class name define करने के लिए किया जाता है जिसे उसे अलग अलग css rules apply किये जा सके।
Ex -<Div class="mydiv">
Style- इसका use div के लिए inline css style define करने के लिए किया जाता है
Ex -<Div style="background- color:pink;color:white; Font-family:monotype corsiva;">
Ex -<Div style="background- color:pink;color:white; Font-family:monotype corsiva;">
Title- इसका use Div के लिए Title या Extra information देने के लिए किया जाता है
Ex -<Div Title="css-Demo">
Program-
<html>
<head>
<Style>
#A
{
Background-color:orange;
Color:white;
Font-family:comics sans ms;
}
#B
{
Background-color:green;
Color:Red;
Font-family:monotype corsiva;
}
.AB
{
Background-color:Navy;
Color:yellow;
Font-family:Times New Romans;
}
</Style>
</head>
<body>
<Div id="A" Title="firstdiv">
<h1>My first heading</h1>
<p>My first paragraph
</Div>
<Div id="B" Title=" Seconddiv">
<h1>My Second heading</h1>
<p>My Second paragraph
</Div>
<Div class="AB" Title="firstclassdiv">
<h1>My first heading</h1>
<p>My first paragraph
</Div>
<Div class="AB" Title=" Secondclassdiv">
<h1>My Second class heading</h1>
<p>My Second class paragraph
</Div>
</body>
</html>
इसी प्रकार हम Div tag मे id के स्थान पर class का use कर सकते है बस css कोड मे हम class का नाम देते समय # के स्थान पर period (.) का use करेगे।
Class और id मे यह अंतर है की id प्रत्येक Element की अलग अलग होती है जबकि हम same class का use एक से अधिक element के लिए कर सकते है
Program-
<html>
<head>
<Style>
#A
{
Background-color:orange;
Color:white;
Font-family:comics sans ms;
}
#B
{
Background-color:green;
Color:Red;
Font-family:monotype corsiva;
}
.AB
{
Background-color:Navy;
Color:yellow;
Font-family:Times New Romans;
}
</Style>
</head>
<body>
<Div id="A" Title="firstdiv">
<h1>My first heading</h1>
<p>My first paragraph
</Div>
<Div id="B" Title=" Seconddiv">
<h1>My Second heading</h1>
<p>My Second paragraph
</Div>
<Div class="AB" Title="firstclassdiv">
<h1>My first heading</h1>
<p>My first paragraph
</Div>
<Div class="AB" Title=" Secondclassdiv">
<h1>My Second class heading</h1>
<p>My Second class paragraph
</Div>
</body>
</html>
इसी प्रकार हम Div tag मे id के स्थान पर class का use कर सकते है बस css कोड मे हम class का नाम देते समय # के स्थान पर period (.) का use करेगे।
Class और id मे यह अंतर है की id प्रत्येक Element की अलग अलग होती है जबकि हम same class का use एक से अधिक element के लिए कर सकते है
How can create div
How can create div part 2 for external css code
Comments
Post a Comment