This forum is now read-only. Please use our new forums! Go to forums
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
Answer 535d739e548c35caa7002495
1 vote
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.
Popular free courses
- Free Course
Learn SQL
In this SQL course, you'll learn how to manage large datasets and analyze real data using the standard data management language.Beginner friendly,4 LessonsLanguage Fluency - Free Course
Learn JavaScript
Learn how to use JavaScript — a powerful and flexible programming language for adding website interactivity.Beginner friendly,11 LessonsLanguage Fluency - Free Course
Learn HTML
Start at the beginning by learning HTML basics — an important foundation for building and editing web pages.Beginner friendly,6 LessonsLanguage Fluency
1 comments
okay thanks :D