Okay so,
This might not be the best question but I am new to programming (I'm 12) I think I've pretty much gotten down HTML and CSS, and I've moved into JavaScript. But I do not understand "div tags" and what they do. Can you please explain this to me? :) Thanks
The HTML
<div>
element (or HTML Document Division Element) is the generic container for flow content, which does not inherently represent anything. It can be used to group elements for styling purposes (using the class or id attributes), or because they share attribute values, such as lang. It should be used only when no other semantic element (such as<article>
or<nav>
) is appropriate.
Example
<div>
<p>Any kind of content here. Such as <p>, <table>. You name it!</p>
</div>
Result
Any kind of content here. Such as <p>, <table>. You name it!
DIV - MDN
As for javascript, its an HTML element and it can be manipulated the same way any other html element can with the except of form elements. HTMLElement - MDN
With each HTML element you have browser default styling, like <b>
and <strong>
tags their default styling is to bold text or font-weight: bold
. And <div>
default styling is display: block
which just means there is a line break before and after each div element, and of course you know you can change the default styling of that element with CSS
Example on how to change the default styling. this will change every <div>
element's text color to red
div {
// change default styling here
color: red;
}
Looks like you'll need some CSS references too, don't use w3school btw. try MDN Learn CSS | MDN
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With