This forum is now read-only. Please use our new forums at discuss.codecademy.com.

About You Forum

View Course » View Exercise

200 points
592fe79310732d3f5222bba0cc5ed1f6?s=140&d=retro
Submitted by
thexmitchell
about 3 years ago

Why do i have to add a semicolon?

<style>
h1 {
text-align: center;
color: orange
}

</style>
<h1>Why do I have to add a semicolon in the following?</h1>

("h1 {
    text-align: center--> ; <--
}")
"h1 {
    text-align: center;
}"

also, <!DOCTYPE html>
what does the <! mean because i saw it in <!-- for comments


1 vote

permalink

CSS rules contain property-value pairs followed by a semicolon. The last declaration doesn't need a semicolon but not using one could make it easier than necessary to create a bug in your code. When you decide to add another declaration to your previous rule, you can easily forget to add the semicolon that you had previously left off.

About the ! in <!DOCTYPE html>, I can't find anywhere that explains why, only that it is part of the HTML Standard.

3691 points
55df2afa95e3787b9200005e_359368177
Submitted by
Judy
about 3 years ago

1 Comment

592fe79310732d3f5222bba0cc5ed1f6?s=140&d=retro thexmitchell about 3 years ago

okay thanks :D