0
HTML
What does div do in html code. And why I can't change the font color even i use font color code?
3 Answers
+ 5
div{
color:red;
}
not::
div{
font-color:red;
}
+ 4
div tags are used to divide your HTML code into sections.
About your second question, it would be better if you provide a code so we can help you.
+ 2
The <div> tag is a container unit that encapsulates other elements within the page and divides the HTML document into sections.
example:
<div>
<p>Lorem Ipsum</p>
</div>
As far as the color of your font, keep in mind that perhaps the specificity of your CSS is overriding the font color selector you're trying to use.
Example of specificity; the first div tag selector would be overridden by the div with the ID selector (#).
div {
color: blue;
}
#div { /* this selector will override */
color: yellow;
}
As mentioned by the comment above, use the shorthand property for the font color.
example:
#div {
color: red;
}