How TO - Style a Header


Learn how to style a header.


Big Header

Try it Yourself »

Create a Header

Step 1) Add HTML:

Example

<div class="header">
  <h1>Header</h1>
  <p>My supercool header</p>
</div>


Step 2) Add CSS:

Style the header with a large padding, centered text, a specific background-color and a big sized text:

Example

.header {
  padding: 60px;
  text-align: center;
  background: #1abc9c;
  color: white;
  font-size: 30px;
}
Try it Yourself »

Ever heard about W3Schools Spaces? Here you can create your website from scratch or use a template, and host it for free.

Get started for free ❯

* no credit card required


Copyright 1999-2023 by Refsnes Data. All Rights Reserved.