+ 2
HTML community, HELP!!
How do div and class in HTML, or i stupid and don't know??
5 ответов
+ 9
Timothy Karpovich ,
the <div> tag is a container block tag which defines a division or section in a Html Document,
whereas the "class" is an attribute which can specify class to an html element .
You can use "class" attribute for styling multiple html elements together.
Eg:
css
.divclass {
color: red;
}
html
<div class="divclass">
This is a para
</div>
+ 3
In HTML, you have different types of containers and tags. But you also have styles and scripts that impact the look and behavior.
A <DIV> tag is a box container. You can put anything inside of a div. Then apply styles or scripts to affect that box.
<HTML>
<BODY>
<DIV class="mydiv" id="mydiv_1">
My stuff goes here
</DIV>
<DIV class="mydiv" id="mydiv_2">
More stuff here
</DIV>
</BODY>
</HTML>
You see how you can use DIV tags to put your content into sections. But how big are the div boxes? What color are they? This is where styles come in. Styles are typically defined using CSS. CSS is a collection of attributes such as color, size, borders, etc. CSS is actually more complex than HTML.
HTML handles basic structure of your document. CSS handles all the look and feel parameters.
Then, when you decide something needs a behavior, such as when you click on a button or if you want something to animate, then you can add scripting using JavaScript.
To build a web page, you will always use HTML and then use CSS and scripting (JavaScript) to fine tune how everything looks and works.
First you learn basic HTML, then learn basic CSS, then learn basic JavaScript.
Now, once you have HTML elements in your document, those elements (tags) can be assigned a name (id) to make it easier to change those items with CSS or JavaScript. Elements can be given an ID, which is unique for that one element. Or you can assign a CLASS, which can be applied to multiple elements. When you create CSS, you tell CSS to apply to either TAGS, a CLASS, or an ID.
If you apply CSS to a TAG, then every use of that tag (<div> <p> etc). This is useful when you want everything to have some common attributes such as having all text be the same color, etc.
If you apply CSS to a CLASS, then all items with that CLASS defined will be affected by your CSS.
If you apply CSS to the ID, then only that one item will be affected.
+ 2
chat GPT cane help you
+ 2
Use gpt
+ 1
I was gonna help you, but these other guys did it for me.