How to Add a Header to Your WordPress Website
A header is a small graphic or a web element that is included at the very top of a web page (or, usually, website). A header is often used to highlight the contents of a webpage, and is displayed in a fixed position at the top of the browser window.
On this page, you will discover step-by-step instructions on how to add a header to your WordPress website. You’ll begin by exploring the different types of headers that you can use, before moving onto the actual adding of the header to your site.
The Different Types Of Headers
Like many CSS properties, the
header CSS property accepts a variety of values, which makes it very versatile. To start with,
header accepts the following types of values:
None: This value indicates that you don’t want any header. In case you’re wondering, the
Nonevalue applies to all the other types of values as well, so if you want to remove the border from your header, you have to specify it. Otherwise, it will remain wherever you’ve specified it to be.
Frozen: This value indicates that you want to add a fixed header (one that won’t scroll with the page). You can also use the
frozenvalue in combination with the
fixedvalue to add a fixed header with a bit of an adjustable height.
Floating: This value indicates that you want to add a header that is positioned on the side of the webpage (floating in the top left or right corner).
Invisible: This value hides the header, making it completely invisible (not even the margin outside the header is visible). However, you can bring it back by specifying an opacity value that allows the contents of the page to be seen through the header (opacity values range from 0 to 1, where 0 is completely transparent and 1 is completely opaque).
Static: This value indicates that you want to add a fixed header that is present on every page (regardless of the contents of the page).
Variable: This value is the opposite of the
staticvalue. With a
variableheader, you can specify the height of the header, and it will adjust itself based on the contents of the page.
Initial: This value indicates that you want to add a header that is visible at the beginning of the page, but it will disappear once the contents of the page have been scrolled down (similar to a sticky or fixed header, except that the header disappears after being displayed once the contents of the page have been scrolled down).
Follow: This value indicates that you want the header to follow the contents of the page as they are scrolled (like a modal footer, for example).
Last-child: This value makes the header appear last in the parent element (i.e., the header is placed after the last child element in the parent element). This value is useful for making sure that your header doesn’t get hidden by an element (like a form or a navigation menu) that comes after it in the DOM.
From the list above, you will see that WP_headers comes with a few more values that you can use. For example, you can add a
shadow effect to the header by using this value in combination with
triton-effect. The last value on the list is
inset, which you can use to add an inset shadow to the header.
Adding A Header To Your Site
Now that you know the different types of headers that you can use, let’s move onto adding one to your site.
The first step is to decide what you want your header to look like. You can either upload a plain-vanilla image to your site or use one of the many header styles that WordPress offers (which are completely free). If you want to create your own custom header, you can find a free vector image (like a rounded rectangle or a heart) on the Stock Photo Library and use it in your design.
Once you’ve decided what you want your header to look like, open the theme editor for your site (either by clicking the Edit button on your WordPress dashboard or by going to <your-website-url>/wp-content/themes/your-theme-name/).
You’ll find a heading1 shortcode in the Blocks area on the left. To add the header to your site, simply click the add button to bring up a dialog box where you can enter the text that you want displayed at the top of your pages.
Here, you can enter the text that you want to appear at the top of your webpage (this will also be used as the menu above the fold, which means the text will be displayed before the user has scrolled down the page).
You can enter the following HTML:
<h1>Enter the Text That You Want To Appear At The Top Of Your Page Here</h1>
<p><p><p><p><p><p><p><p><p>It's a good idea to go over the text you've entered to make sure it's appropriate and that you haven't entered any errors.
Once you've verified the text, click the Update button to save it.
Back in the theme editor, you'll see that the heading1 you just entered has been replaced with the text that was previously entered.
This is the default text that will be used by your site.
To add a bit of polish to your website, you can find a nice icon (like a play button or a heart) in your theme's design section and use it as the link to different parts of your website (like a button that, when clicked, takes the user to a contact page or a page with social media links).
If you want to add a bit of flair to your site, you can find a gradient in your theme's design section and apply it to the background-color of your webpage's body element (i.e., whatever happens to be underneath the header, the navigation, and the footer). You can find a corner-radius value in your theme's design section and use it to round off the corners of your page's borders (this can be useful for giving your site a polished look).
Once you've added the text you want at the top of your page, you can click the Add Another button to add another header to your site. You can continue adding headers until you've reached the desired number (you can find the Add Another button on the top of your page in the Blocks area).
To add a bit of mystery to your website, you can find a triton-effect in your theme's design section and apply it to the background-color of your webpage's body element. This will give the appearance that something magical happened on your site (i.e., that a giant fish appeared out of nowhere and jumped out of the page!). To create this effect, simply enter the following code into the body of your webpage: