0
What is the physical meaning of <div> element?
When learning about this inline and block learning, div element came up. It is given that <div> element is used as a container for other elements. What does it mean? By 'container' what are they conveying?
8 odpowiedzi
+ 2
Raghunath Thiagarajan
<div> is a container of other elements because you could put in other elements in it.
Example
<did id="header">
<h3>Welcome To Sololearn</h3>
</div>
Div is a short for "Division"
+ 1
Is it because attributes need an element to function?
+ 1
I don't understand
+ 1
You could write the code with or without using any attribute
+ 1
from: https://www.w3schools.com/Tags/tag_div.asp
" The <div> tag defines a division or a section in an HTML document "
How I think of a container is like a bucket. So let us use an example. I have a Blue bucket and a Brown bucket. In the Blue bucket I have Apples and Pears.In the Brown Oranges and Lemons.
You are my Shop styler. I tell you to put the Blue bucket on the top shelf and the Brown bucket on the bottom shelf.
The writing of it can be thought of similar to brackets in C.
{ //opening bracket
Stuff inside brackets
} // closing bracket
So buckets above in HTML would be written as.
<div class="Blue Bucket"> <!--This is the beginning of my blue bucket-->
Apples<br>
Pears
</div> <!-- this is the end of my blue bucket, everything inside is contained within the blue bucket
-->
<div class="Brown Bucket"> <!--This is the beginning of my brown bucket-->
Oranges<br>
Lemons
</div> <!-- this is the end of my brown bucket, everything inside is contained within the brown bucket-->
0
Attributes like header can't be written simply, right?
0
Maybe try:
http://dustwell.com/div-span-inline-block.html
And, yeah, "style" is an attribute (you can think of it like a trait). Attributes are expressed through elements. "display" is a property of an attribute. "inline" and "block" are acceptable values for the "display" property.
0
Thank you so much. Gave me a clear picture