All new knowledge bases are created with no banner image on the homepage. If you'd like to add one, you can choose to replace it with:
- A solid color
- A color gradient
- An image of your choice
Steps for each are outlined below.
Before you begin
Only use if you have no banner
These instructions assume you do not already have a banner image set up on your homepage. If you DO already have some type of banner image or colored section on your homepage, check out Change the background image on my homepage!
Before you begin, you'll need to know two things:
- The color(s) you'd like to use for a solid color or color gradient background (hexes, RGB, or browser default names are fine) OR the image you'd like to use
- Whether you're using our out-of-the-box Support Theme or a customized theme (read on in this section for more details)
To figure out if you're using our out-of-the-box Support Theme, first, be sure your knowledge base currently doesn't display a banner image of any kind on the homepage. If it does, head over to Change the background image on my homepage instead.
Then:
- Check if your Custom CSS begins with a comment with General structure at the top:
- If it does, you're using our new Support Theme. You can follow any of the instructions below without making any adjustments.
- If it doesn't begin with that section, your knowledge base has a customized theme. You'll need to see if there's any CSS that includes
.ko-homepage-top
and adjust that CSS. You can use the instructions below as a guide, but you may need to make additional tweaks.
Replace with a solid color
To add a solid color to your homepage banner area:
- Go to Settings > Style.
- In the Customize HTML, CSS, and JS section, be sure Custom CSS is selected.
- Find the Homepage Top and General section of your Custom CSS, which should be at or near row 332:
- The changes we're making should all be within the
.hg-minimalist-theme .ko-homepage-top
section, rows 334-338 in the screenshot above. - Remove
background: none;
- Copy the code below and paste it in where the
background: none;
was:background-color: #8bc34a; /* set background color for homepage banner */ background-image: none; /* ensure no background image displays */
- Adjust the background-color value to be the hex or rgb value of your choice.
- Your final CSS should look something like this, with your background-color hex of choice:
/******************************************************** Homepage Top and General */ /* get rid of background banner and add some padding to top of homepage */ .hg-minimalist-theme .ko-homepage-top { background-color: #8bc34a; /* set background color for homepage banner */ background-image: none; /* ensure no background image displays */ padding-top: 2em; padding-bottom: 0em; }
- Optional: if you'd like the banner to extend slightly below the search box on the homepage, remove the
padding-bottom: 0em;
line from that Custom CSS. - Be sure to Save your changes.
Replace with a color gradient
What if you'd rather use a color gradient, instead of a solid color, for your banner area?
Don't worry, you don't have to know anything about image editing tools and don't have to generate it yourself. There's a built-in CSS function that can do color gradients for you--you just need to know which colors you want to feed in! You'll need at least two colors to pass in to the function; you can used browser default named colors (like red, yellow, blue), hexes, or rgb values for specific brand colors.
In our example below, we use browser default named colors.
To add a color gradient area to the top of your homepage:
- Go to Settings > Style.
- In the Customize HTML, CSS, and JS section, be sure Custom CSS is selected.
- Find the Homepage Top and General section of your Custom CSS, which should be at or near row 332:
- The changes we're making should all be within the
.hg-minimalist-theme .ko-homepage-top
section, rows 334-338 in the screenshot above. - Remove
background: none;
- Copy the code below and paste it in where the
background: none;
was:background-image: linear-gradient(red, yellow);
/* set background color gradient */ - Replace the linear-gradient values with your choice. You must have at least two colors but can have more, and you can also specify direction and/or degree. Refer to the W3School's entry for linear-gradient function for more details.
- Your final CSS should look like this, with whatever colors you've selected:
/******************************************************** Homepage Top and General */ /* get rid of background banner and add some padding to top of homepage */ .hg-minimalist-theme .ko-homepage-top { background-image: linear-gradient(red, yellow); /* set background color gradient */ padding-top: 2em; padding-bottom: 0em; }
- Optional: if you'd like the banner to extend slightly below the search box on the homepage, remove the
padding-bottom: 0em;
line from that Custom CSS. - Be sure to Save your changes.
Replace with your own image
First, you'll need to find an image you'd like to use. This can involve some trial and error.
Here are some tips to help you find a good image:
- Ideally you want an image with a 5:1 aspect ratio, so it's much wider than it is tall.
- Large overall dimensions tend to work better, around 1500px x 300px is a good place to start, though we have no set requirements.
- The overall image file size should be relatively small. Ideally the image file size is in kilobytes (KB) not megabytes (MB) as large files will slow down your page load time.
- If you have the choice between a .jpg and a .png file, choose the .png. PNG files tend to scale better with different screen sizes, whereas .jpg can become a little fuzzy at certain resolutions. If you have the choice for a .webp file, use that.
- Alternatively, choose a smaller image that would look nice as tiles in the background.
Once you have an image that you'd like to work with:
- Go to Library > Files and upload it to your File Library.
- Once you've uploaded your image file, find the URL. Copy it and paste it into a text editor or somewhere else--we'll need it later!
- Go to Settings > Style.
- In the Customize HTML, CSS, and JS section, be sure Custom CSS is selected.
- Find the Homepage Top and General section of your Custom CSS, which should be at or near row 332:
- The changes we're making should all be within the
.hg-minimalist-theme .ko-homepage-top
section, rows 334-338 in the screenshot above. - Remove
background: none;
- Copy the code below and paste it in where the
background: none;
was:background-image: url("/css/images/tweed.png");
- Replace
/css/images/tweed.png
with the URL you copied in Step 2 from the File Library. Keep the URL in "quotes". So, for example, here's what it might look like using a URL from our File Library:/******************************************************** Homepage Top and General */ /* get rid of background banner and add some padding to top of homepage */ .hg-minimalist-theme .ko-homepage-top { background-image: url("https://dyzz9obi78pm5.cloudfront.net/app/image/id/1ab1ab1ab1ab1ab1ab1ab1ab1/n/sample-banner-image.png"); padding-top: 2em; padding-bottom: 0em; }
- Optional: if you'd like the banner to extend slightly below the search box on the homepage, remove the padding-bottom line from that Custom CSS.
- Once you're happy with your image changes, be sure to Save your changes.
- If you have repeating or other issues, see the steps below to troubleshoot further.
Is your image repeating or stretched weirdly?
If your image is smaller than the space provided it will repeat itself or stretch oddly:
To fix this, you have two options:
- Add
background-size: cover;
to your CSS. This will stretch the image to make it fit the overall dimensions. Sometimes this works well, but sometimes it distorts or cuts off parts of the image, so take a good look at the results. Your resulting CSS should look something like this:.hg-minimalist-theme .ko-homepage-top { background-image: url("
https://dyzz9obi78pm5.cloudfront.net/app/image/id/1ab1ab1ab1ab1ab1ab1ab1ab1/n/sample-banner-image.png
"); background-size: cover; padding-top: 2em; padding-bottom: 0em; } - If you don't like the look of
background-size: cover;
, try addingbackground-size: 100% 100%;
to your CSS. This will try to stretch the image proportionately to fit the screen it's displayed on, which can be more elegant for lots of different devices and sometimes bypasses the off-center distortion ofbackground-size: cover;
. Your resulting CSS should look like something like this:.hg-minimalist-theme .ko-homepage-top { background-image: url("
https://dyzz9obi78pm5.cloudfront.net/app/image/id/1ab1ab1ab1ab1ab1ab1ab1ab1/n/sample-banner-image.png
");background-size: 100% 100%; padding-top: 2em; padding-bottom: 0em; }