+ 2
Why does style tag in html doesn't work
9 Antworten
+ 7
Because, You Didn't Choose Any Element To Style!
You Have To Choose The Element To Style Like:
element{
/* The CSS Code */
}
+ 4
You have to include an element like
div{
background: ;
}
+ 2
Sancho Godingo what do you mean?
+ 2
That, You Didn't Add An Element That You're Targeting To Style...
You Directly Wrote The Style But, For Which Element?
So, Choose The Element By My Above Answer.
If You Still Didn't Understand, Go Through The HTML & CSS Course Again...
+ 2
If You Want It For The Body Tag,
Then Use:
body{
/* The Code You Wrote In The Style Tag */
}
+ 1
Sancho Godingo do you mean like
body{
}
or
*{
}
+ 1
Specify any tag element in the body section, like <h1> <p> <div> tags, etc. And style the content with either id or class class attribute, in the style section.
+ 1
You need to define the element that the style will be applied to. If you want it to be the background to the body for example:
Body{
Background: …
}
But if you only want it for divs with a class bg;
.bg {
Background: …
}
0
style tag will work in head section of html
style attribute is allowed in all tags of html