Introduction
Hey Ninjas! Do you want to learn about HTML? Does building sites on the internet excite you? Do you want to pursue a career in web development? Well, you are in the right place.
Here we will be taking a look at the HTML header tag. Where HTML tags are used and how attributes can modify them based on the needs will be discussed in this article. We will also be writing some code to show how the tags are registered, so get ready as you delve into the world of web development.
What are Header Tags?
First, let’s discuss HTML and HTML tags in general. A webpage’s content is written using HTML or Hyper Text Markup language. HTML has got tags that help to create various sections in a webpage. We can develop paragraphs, change font size, add images or even add hyperlinks to other web pages. We can use HTML tags to wrap pictures or text to apply their properties to the content covered.
The HTML header tag is one of the many tags in HTML. The header tag is used to write a page or webpage section. It is displayed as a “banner” in the accessibility tree when it is a global site header. A few items in the header can include a logo, organization name, search bar, and navigation links. The header tag is generally written at the top of a webpage when declared a global header.
Syntax
The HTML header tag has an opening tag and a closing tag. All the content meant to be in the header is between the tags. The opening tag <header>, and the closing tag </header>.
Attributes
The HTML header tag contains all the global attributes. Some of the attributes which might be very useful are
-
Class: The class attribute can assign a class name to a tag. CSS and JavaScript can access the properties of the content in the header tag through the class name.
-
Id: The id tag can assign an identity to a header tag. The id attribute and class are very similar in terms of usage. The only difference is that no 2 HTML tags can have the same id, but many tags can have the same class name.
- Style: The style tag alters the CSS properties of the header tag. CSS properties like font size, text color, and background color can be changed using this property in the tag itself.
Many other tags are there in HTML.